ci(publish): (wip) add .goreleaser.yml
, pt. 2
#126
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: | |
- "*" | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
jobs: | |
create-release: | |
name: Create GitHub release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: ${{ contains(github.ref, '-') }} | |
build-release: | |
name: Build release binaries for ${{ matrix.target }} | |
needs: [create-release] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup extra build tools | |
if: matrix.target == 'aarch64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build | |
run: | | |
cargo build --verbose --bin=pacaptr --release --locked --target=${{ matrix.target }} | |
# https://github.com/vercel/turbo/blob/ea934d13038361c24a1f71cad3b490d6c0936f37/.github/workflows/turborepo-release.yml#L268-L272 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pacaptr-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/pacaptr* | |
retention-days: 1 | |
publish: | |
name: Publish via GoReleaser | |
needs: [build-release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# https://github.com/vercel/turbo/blob/ea934d13038361c24a1f71cad3b490d6c0936f37/.github/workflows/turborepo-release.yml#L306-L309 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist/gh-artifacts | |
- name: Inspect artifacts | |
run: | | |
ls -R dist/gh-artifacts | |
# https://goreleaser.com/ci/actions/?h=github+act#usage | |
- name: Publish via GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} | |
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} |