prepare for release #8
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
on: | |
push: | |
tags: | |
- "v*" | |
name: Release | |
jobs: | |
# cargo_publish: | |
# name: Publish to crates.io | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Publish | |
# run: cargo publish --locked --token ${{ secrets.CRATES_IO_TOKEN }} | |
create_release: | |
name: Create draft release | |
runs-on: ubuntu-latest | |
permissions: write-all | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create draft release | |
run: gh release create ${{ github.ref_name }} --notes "" --draft | |
build: | |
name: Build binaries | |
needs: create_release | |
runs-on: ${{ matrix.os }} | |
permissions: write-all | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BUILD_FLAGS: build --release --locked --target ${{ matrix.target }} | |
ARCHIVE_NAME: fixit-${{ github.ref_name }}-${{ matrix.target }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
cross: true | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
cross: false | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
cross: false | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
cross: false | |
steps: | |
- name: Install cargo-binstall | |
if: ${{ matrix.cross }} | |
uses: cargo-bins/cargo-binstall@main | |
- name: Install cargo cross | |
if: ${{ matrix.cross }} | |
run: "cargo binstall --git https://github.com/cross-rs/cross cross" | |
- name: Add Rust target | |
if: ${{ ! matrix.cross }} | |
run: rustup target add ${{ matrix.target }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build (cargo) | |
if: ${{ ! matrix.cross }} | |
run: cargo $BUILD_FLAGS | |
- name: Build (cross) | |
if: ${{ matrix.cross }} | |
run: cross $BUILD_FLAGS | |
- name: Create archive | |
run: mv ./target/${{ matrix.target }}/release/fixit . && tar -czvf $ARCHIVE_NAME.tar.gz fixit | |
- name: Checksum | |
run: cat test.tar.gz | shasum -a 256 | cut -d " " -f 1 > $ARCHIVE_NAME.sha256 | |
- name: Upload artifacts | |
run: gh release upload ${{ github.ref_name }} $ARCHIVE_NAME.{tar.gz,sha256} | |
publish_release: | |
name: Publish release | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: write-all | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Publish release | |
run: gh release edit ${{ github.ref_name }} --draft=false |