fixup #235
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: release | |
on: | |
# schedule: | |
# - cron: "5 5 * * *" | |
workflow_dispatch: | |
# inputs: | |
# tag_name: | |
# description: "Tag name for release" | |
# required: false | |
# default: nightly | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
env: | |
CARGO_TERM_COLOR: always | |
USE_CROSS: true | |
FETCH_DEPTH: 0 | |
RELEASE_NAME: "stow-cm" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ${{ matrix.build.os }} | |
continue-on-error: true | |
strategy: | |
fail-fast: false | |
matrix: | |
# build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] | |
build: [ | |
{ | |
plat: linux, | |
os: ubuntu-latest, | |
rust: stable, | |
target: x86_64-unknown-linux-musl, | |
}, | |
{ | |
plat: macos, | |
os: macos-latest, | |
rust: stable, | |
target: x86_64-apple-darwin, | |
}, | |
# { | |
# plat: linux-arm, | |
# os: ubuntu-latest, | |
# rust: stable, | |
# target: arm-unknown-linux-gnueabihf | |
# }, | |
# { | |
# plat: win-msvc, | |
# os: windows-latest, | |
# rust: stable, | |
# target: x86_64-pc-windows-msvc | |
# }, | |
# { | |
# plat: win-gnu, | |
# os: windows-latest, | |
# rust: stable-x86_64-gnu, | |
# target: x86_64-pc-windows-gnu | |
# }, | |
# { | |
# plat: win32-msvc, | |
# os: windows-latest, | |
# rust: stable, | |
# target: i686-pc-windows-msvc | |
# }, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.build.rust }} | |
targets: ${{ matrix.build.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: build release binary | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target=${{ matrix.build.target }} | |
use-cross: ${{ env.USE_CROSS }} | |
- name: Strip release binary (linux and macos) | |
if: matrix.build.plat == 'linux' || matrix.build.plat == 'macos' | |
run: strip "target/${{ matrix.build.target }}/release/${{ env.RELEASE_NAME }}" | |
- name: Strip release binary (arm) | |
if: matrix.build.plat == 'linux-arm' | |
run: | | |
docker run --rm -v \ | |
"$PWD/target:/target:Z" \ | |
rustembedded/cross:arm-unknown-linux-gnueabihf \ | |
arm-linux-gnueabihf-strip \ | |
/target/arm-unknown-linux-gnueabihf/release/${{ env.RELEASE_NAME }} | |
- name: Build archive | |
shell: bash | |
run: | | |
staging="${{ env.RELEASE_NAME }}-${{ matrix.build.target }}" | |
mkdir -p "$staging" | |
mkdir -p "artifacts" | |
cp {README.md,LICENSE} "$staging/" | |
if [ "${{ matrix.build.os }}" = "windows-latest" ]; then | |
cp "target/${{ matrix.build.target }}/release/${{ env.RELEASE_NAME }}.exe" "$staging/" | |
7z a "artifacts/$staging.zip" "$staging" | |
sha256sum "artifacts/$staging.zip" > "artifacts/$staging.zip.sha256sum" | |
else | |
cp "target/${{ matrix.build.target }}/release/${{ env.RELEASE_NAME }}" "$staging/" | |
tar czf "artifacts/$staging.tar.gz" "$staging" | |
shasum -a 256 "artifacts/$staging.tar.gz" > "artifacts/$staging.tar.gz.sha256sum" | |
fi | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact # NOTE: same artifact name | |
path: artifacts/* | |
if-no-files-found: error | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: download assets | |
uses: actions/download-artifact@v4 | |
- name: create tag release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
tag_name: "${{ github.ref_name }}" | |
name: "Release ${{ github.ref_name }}" | |
target_commitish: "${{ github.sha }}" | |
prerelease: false | |
draft: false | |
fail_on_unmatched_files: false | |
files: | | |
artifact/* | |
- name: create stable release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
tag_name: "stable" | |
name: "Release stable" | |
target_commitish: "${{ github.sha }}" | |
prerelease: false | |
draft: false | |
fail_on_unmatched_files: false | |
files: | | |
artifact/* |