Prepare Releases #33
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: Prepare Releases | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
release: | |
name: release ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-22.04 | |
rust: nightly | |
target: x86_64-unknown-linux-gnu | |
- build: windows-gnu | |
os: windows-2022 | |
rust: nightly | |
target: x86_64-pc-windows-gnu | |
# howlong is apparently broken on darwin, not only when cross-compiling | |
# - build: darwin | |
# os: macos-12 | |
# rust: nightly | |
# target: x86_64-apple-darwin | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install rust toolchain | |
uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{ matrix.rust }} | |
targets: ${{ matrix.target }} | |
- name: Install cross | |
# cf. https://github.com/cross-rs/cross/issues/1453 | |
#run: cargo install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build release binary | |
run: cross build --release --bin=nmo --target=${{ matrix.target }} | |
- name: Strip release binaries (linux and darwin) | |
if: matrix.build == 'linux' || matrix.build == 'darwin' | |
run: strip "target/${{ matrix.target }}/release/nmo" | |
- name: Build archive | |
shell: bash | |
run: | | |
name="${{ format('nemo_{0}_{1}', github.ref_name, matrix.target) }}" | |
mkdir -p "$name" | |
cp {README.md,LICENSE-APACHE,LICENSE-MIT} "$name" | |
if [ "${{ matrix.os }}" = "windows-2022" ]; then | |
cp "target/${{ matrix.target }}/release/nmo.exe" "$name/" | |
asset=$name.zip | |
7z a "$asset" "$name" | |
echo ASSET=$asset >> $GITHUB_ENV | |
else | |
cp "target/${{ matrix.target }}/release/nmo" "$name/" | |
asset=$name.tar.gz | |
tar czf "$asset" "$name" | |
echo ASSET=$asset >> $GITHUB_ENV | |
fi | |
sha256sum "$asset" > "$asset.sha256sum" | |
- name: Create (draft) release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "Nemo ${{ github.ref_name }}" | |
fail_on_unmatched_files: false | |
generate_release_notes: true | |
make_latest: true | |
draft: true | |
files: | | |
nemo_*.zip | |
nemo_*.tar.gz | |
nemo_*.zip.sha256sum | |
nemo_*.tar.gz.sha256sum |