Release v0.8.24 with apply=true #155
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: Release | |
run-name: Release v${{ inputs.version }} with apply=${{ inputs.apply }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: version. The next release version (without prefix v) | |
required: true | |
apply: | |
description: apply. Specify whether the atcual release should be performed or not | |
type: boolean | |
permissions: {} | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
suffix: .tar.gz | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
suffix: .tar.gz | |
- target: x86_64-apple-darwin | |
os: macOS-latest | |
suffix: .tar.gz | |
- target: aarch64-apple-darwin | |
os: macOS-latest | |
suffix: .tar.gz | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
suffix: .zip | |
- target: aarch64-pc-windows-msvc | |
os: windows-latest | |
suffix: .zip | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
steps: | |
- run: sudo apt-get update --yes && sudo apt-get install --yes --no-install-recommends libx11-xcb-dev libxcb-shape0-dev libxcb-xfixes0-dev musl-tools | |
if: matrix.os == 'ubuntu-latest' | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- name: Install cross | |
if: matrix.os == 'ubuntu-latest' | |
uses: taiki-e/install-action@cross | |
- name: Build with Cargo | |
if: matrix.os != 'ubuntu-latest' | |
run: cargo build --release --locked --target ${{ matrix.target }} | |
- name: Build with Cross | |
if: matrix.os == 'ubuntu-latest' | |
run: cross build --release --locked --target ${{ matrix.target }} | |
- name: Bundle on Windows | |
run: 7z a ../../../thwack-${{ matrix.target }}${{ matrix.suffix }} thwack.exe | |
if: matrix.os == 'windows-latest' | |
working-directory: target/${{ matrix.target }}/release | |
- name: Bundle on -nix | |
run: tar cf ../../../thwack-${{ matrix.target }}${{ matrix.suffix }} thwack | |
if: matrix.os != 'windows-latest' | |
working-directory: target/${{ matrix.target }}/release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Artifact-thwack-${{ matrix.target }}${{ matrix.suffix }} | |
path: thwack-${{ matrix.target }}${{ matrix.suffix }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- run: sudo apt-get update --yes && sudo apt-get install --yes --no-install-recommends libx11-xcb-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
- uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Bump the package version | |
run: | | |
sed -i -e "s/^version = .*$/version = \"${{ inputs.version }}\"/" Cargo.toml | |
cargo build | |
- uses: yykamei/actions-git-push@main | |
with: | |
commit-message: Bump to ${{ inputs.version }} | |
if: inputs.apply | |
- name: Create a GitHub release and publish the crate on crates.io | |
run: ./scripts/release.sh | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
VERSION: ${{ inputs.version }} | |
APPLY: ${{ inputs.apply }} | |
- uses: actions/download-artifact@v4 | |
- name: Calculate checksums | |
run: | | |
mv Artifact-thwack-*/thwack-* . | |
for f in thwack-*; do sha256sum "$f" | awk '{print $1}' > "${f}.sha256"; done | |
- name: Upload assets to the release | |
if: inputs.apply | |
run: gh release upload "v${{ inputs.version }}" thwack-* | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |