Release #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cosmo cli Release | |
on: [create] | |
jobs: | |
release: | |
if: github.event_name == 'create' && github.event.ref_type == 'tag' | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Code checkout | |
uses: actions/checkout@v2 | |
# Compile x86_64 | |
- name: Install Rust toolchain (x86_64-unknown-linux-gnu) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: "1.64" | |
target: x86_64-unknown-linux-gnu | |
- name: Install Rust toolchain (x86_64-unknown-linux-musl) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: "1.64" | |
target: x86_64-unknown-linux-musl | |
- name: Build (x86_64-unknown-linux-gnu) | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
toolchain: "1.64" | |
command: build | |
args: --release --target=x86_64-unknown-linux-gnu | |
- name: Build (x86_64-unknown-linux-musl) | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
toolchain: "1.64" | |
command: build | |
args: --release --features "vendored-openssl" --target=x86_64-unknown-linux-musl | |
# Create Release | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: false | |
body: "" | |
# Create and upload vendored source | |
- name: Create release directory | |
run: rsync -rv --exclude=.git . ../cosmo-${{ github.event.ref }} | |
- name: Cargo vendor | |
working-directory: ../cosmo-${{ github.event.ref }} | |
run: | | |
mkdir ../vendor-cargo-home | |
export CARGO_HOME=$(realpath ../vendor-cargo-home) | |
mkdir -p .cargo | |
cargo vendor >> .cargo/config.toml | |
- name: Create vendored source archive | |
working-directory: ../ | |
run: tar cJf cosmo-${{ github.event.ref }}.tar.xz cosmo-${{ github.event.ref }} | |
- name: Upload cosmo vendored source archive | |
id: upload-release-cosmo-vendored-sources | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ../cosmo-${{ github.event.ref }}.tar.xz | |
asset_name: cosmo-${{ github.event.ref }}.tar.xz | |
asset_content_type: application/x-xz | |
# Upload binaries | |
- name: Upload cosmo x86_64 | |
id: upload-release-cosmo-x86_64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/x86_64-unknown-linux-gnu/release/cosmo | |
asset_name: cosmo-linux-x86_64 | |
asset_content_type: application/octet-stream | |
- name: Upload static cosmo x86_64 | |
id: upload-release-static-cosmo-x86_64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/x86_64-unknown-linux-musl/release/cosmo | |
asset_name: cosmo-linux-x86_64-static | |
asset_content_type: application/octet-stream |