Version bump #2
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: Publish | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+ | |
permissions: read-all | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
name: Build (${{ matrix.os-name }}, ${{ matrix.target }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: aarch64-apple-darwin | |
os: macos-12 | |
os-name: MacOS | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
os-name: Ubuntu | |
- target: x86_64-apple-darwin | |
os: macos-12 | |
os-name: MacOS | |
- target: x86_64-pc-windows-msvc | |
os: windows-2022 | |
os-name: Windows | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-22.04 | |
os-name: Ubuntu | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- name: Install Rust toolchain | |
env: | |
TARGET: ${{ matrix.target }} | |
run: | | |
rustup show | |
rustup target add "$TARGET" | |
- name: Install cross | |
uses: taiki-e/install-action@bd71f121e3951933204a4d1cf9256d934f5600a5 # v2.27.0 | |
with: | |
tool: [email protected] | |
- name: Build binary | |
env: | |
TARGET: ${{ matrix.target }} | |
run: cross build --release --target "$TARGET" | |
- name: Create archive | |
id: archive | |
shell: bash | |
env: | |
OS_NAME: ${{ matrix.os-name }} | |
TARGET: ${{ matrix.target }} | |
run: | | |
NAME='rust-rm' | |
ARTIFACT_NAME="$NAME-$TARGET" | |
mkdir "$ARTIFACT_NAME" | |
if [ "$OS_NAME" = 'Windows' ]; then | |
mv "./target/$TARGET/release/$NAME.exe" "./$NAME.exe" | |
else | |
mv "./target/$TARGET/release/$NAME" "./$NAME" | |
fi | |
if [ "$OS_NAME" = 'Windows' ]; then | |
7z a "$ARTIFACT_NAME.zip" "./$NAME.exe" | |
echo "artifact=$ARTIFACT_NAME.zip" >>"$GITHUB_OUTPUT" | |
else | |
tar -czf "$ARTIFACT_NAME.tar.gz" "./$NAME" | |
echo "artifact=$ARTIFACT_NAME.tar.gz" >>"$GITHUB_OUTPUT" | |
fi | |
- name: Upload archive | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
path: ${{ steps.archive.outputs.artifact }} | |
retention-days: 1 | |
github-release: | |
name: GitHub Release | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write # To create a GitHub Release | |
needs: | |
- build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
- name: Fetch tags | |
run: git fetch --tags --force | |
- name: Get release version | |
id: version | |
shell: bash | |
run: | | |
echo "version=${GITHUB_REF#refs/tags/}" >>"$GITHUB_OUTPUT" | |
- name: Get release notes | |
id: notes | |
shell: bash | |
run: | | |
{ | |
echo 'notes<<EOF' | |
git for-each-ref "$GITHUB_REF" --format '%(contents)' | |
echo 'EOF' | |
} >>"$GITHUB_OUTPUT" | |
- name: Download artifacts | |
uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3 | |
id: download | |
with: | |
path: ${{ runner.temp }}/artifacts | |
- name: Create GitHub release | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 | |
with: | |
tag: ${{ steps.version.outputs.version }} | |
name: Release ${{ steps.version.outputs.version }} | |
body: ${{ steps.notes.outputs.notes }} | |
artifacts: ${{ steps.download.outputs.download-path }}/artifact/* | |
draft: false | |
prerelease: false |