name: macos-release
on:
push:
tags:
- "*"
jobs:
build:
name: Build on macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Build
env:
RUSTFLAGS: "-C link-arg=-s -C target-feature=+crt-static"
run: |
cargo build --release --locked
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: binary
path: target/release/crowbar
test:
name: Test on macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Test
env:
RUSTFLAGS: "-C link-arg=-s -C target-feature=+crt-static"
run: |
cargo fmt -- --check
cargo clippy --release
cargo test --release --locked
release:
runs-on: macos-latest
needs: [build, test]
steps:
- name: Set the release tag
id: set_tag
run: echo ::set-output name=RELEASE_TAG::${GITHUB_REF/refs\/tags\/v/}
shell: bash
- name: Restore artifact from previous job
uses: actions/download-artifact@v3
with:
name: binary
- name: Upload binaries to release
uses: svenstaro/upload-release-action@2.5.0
with:
file: crowbar
asset_name: crowbar-x86_64-macos
overwrite: true
- name: Bump Homebrew formula
uses: mislav/bump-homebrew-formula-action@v2
with:
formula-name: crowbar
homebrew-tap: moritzheiber/homebrew-tap
base-branch: master
download-url: "https://github.com/moritzheiber/crowbar/releases/download/v${{ steps.set_tag.outputs.RELEASE_TAG }}/crowbar-x86_64-macos"
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}