Skip to content

Release

Release #45

Workflow file for this run

name: Release
on:
workflow_run:
workflows: ['CI']
types: [completed]
env:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash # Convenience workaround for Windows.
jobs:
build:
if: github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-linux
- os: windows-latest
target: x86_64-windows
# Apple targets are not properly signed. Users will have to mark the binaries as secure manually.
- os: macos-12
target: x86_64-apple-darwin
- os: macos-latest
target: arm64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install libfuse2
sudo wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
sudo chmod +x /usr/local/bin/appimagetool
cargo install cargo-appimage
- name: Build
run: |
cargo build --release --verbose
if [[ $RUNNER_OS == "Linux" ]]; then
cargo appimage
fi
- name: Prepare artifacts
run: |
mkdir -p ./artifacts
version="$GITHUB_REF_NAME"
artifact="wthrr-$version-${{ matrix.target }}"
mkdir "$artifact"
cp README.md LICENSE "$artifact/"
if [[ $RUNNER_OS == "Windows" ]]; then
mv "./target/release/wthrr.exe" "./$artifact/"
elif [[ $RUNNER_OS == "Linux" ]]; then
mv "./target/release/wthrr" "./$artifact/"
mv ./wthrr-*-x86_64.AppImage "./artifacts/"
fi
tar -czf "./artifacts/$artifact.tar.gz" "$artifact"
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: result
path: ./artifacts
deploy:
needs: build
if: github.ref_name == 'main' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: result
path: ./artifacts
- name: List
run: find ./artifacts
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*.tar.gz, ./artifacts/*.AppImage
publish:
needs: build
if: github.ref_name == 'main' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Publish
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}