Skip to content

Release Time

Release Time #78

Workflow file for this run

name: goreleaser
on:
push:
# run only against tags
tags:
- "*"
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
permissions:
contents: write
# packages: write
issues: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check that the Cargo.yaml has been updated with tag
if: ${{ !inputs.debug_enabled }}
run: |
if ! grep -E "version[ ]*=[ ]*.${GITHUB_REF#refs/tags/}." Cargo.toml; then
echo "Cargo.toml version does not match tag, version in current Cargo.toml:"
exit 1
fi
build:
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
needs: check
env:
BUILD_CMD: cargo
EXTENSION: ""
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: windows-2019, target: x86_64-pc-windows-msvc }
- { os: macos-latest, target: x86_64-apple-darwin }
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-20.04,
use-cross: true,
}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --force --tags
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.target }}
- uses: Swatinem/rust-cache@v2
- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
- name: Show version information (Rust, cargo, GCC)
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name: Add Extension variable on windows
if: matrix.job.os == 'windows-2019'
shell: bash
run: echo "EXTENSION=.exe" >> $GITHUB_ENV
- name: Build on ${{ matrix.job.target }}
shell: bash
run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }}
- uses: actions/upload-artifact@v4
with:
name: snazy-${{ matrix.job.target }}
path: target/${{ matrix.job.target }}/release/snazy${{ env.EXTENSION }}
goreleaser:
name: Goreleaser over Rust
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: snazy-x86_64-unknown-linux-gnu
path: target/linux_amd64/snazy
- uses: actions/download-artifact@v4
with:
name: snazy-x86_64-apple-darwin
path: target/darwin_amd64/snazy
- uses: actions/download-artifact@v4
with:
name: snazy-aarch64-unknown-linux-gnu
path: target/linux_arm64/snazy
- uses: actions/download-artifact@v4
with:
name: snazy-x86_64-pc-windows-msvc
path: target/windows_amd64/snazy.exe
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_PRIVATE_KEY: ${{ secrets.AUR_PRIVATE_KEY }}
# - uses: katyo/publish-crates@v2
# with:
# registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}