Skip to content

Fix gh action release #5

Fix gh action release

Fix gh action release #5

Workflow file for this run

name: Release
permissions:
contents: write
on:
push:
tags:
- v*
jobs:
release:
timeout-minutes: 20
permissions:
contents: write
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-20.04
targets: ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]
dependencies: |
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- os: macos-latest
targets: ["x86_64-apple-darwin", "aarch64-apple-darwin"]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/[email protected]
- name: Rust setup
uses: dtolnay/rust-toolchain@1ff72ee08e3cb84d84adba594e0a297990fc1ed3
- name: Rust cache
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
with:
shared-key: "release-${{ matrix.os }}"
- name: Install dependencies
if: matrix.dependencies != ''
run: ${{ matrix.dependencies }}
- name: Add targets
run: |
for target in ${{ join(matrix.targets, ' ') }}; do
rustup target add $target
done
- name: Build targets
run: |
for target in ${{ join(matrix.targets, ' ') }}; do
cargo build --release --target $target
done
- name: Prepare release artifacts
run: |
mkdir -p artifacts
for target in ${{ join(matrix.targets, ' ') }}; do
# Remove vendor names ('-apple' and '-unknown') from the target name
target_name=$(echo $target | sed 's/-apple//; s/-unknown//')
# Remove platform names ('-gnu', 'musl') from the target name
target_name=$(echo $target_name | sed 's/-gnu//; s/-musl//')
echo "target_name: $target_name"
cp "target/$target/release/sm" "artifacts/secrets-machine-${target_name}"
done
- name: Release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
files: artifacts/secrets-machine*
- name: Clean up
run: rm -rf artifacts