Skip to content

Release

Release #148

Workflow file for this run

name: Release
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
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 }}
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: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --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/checkout@v4
with:
token: ${{ secrets.PAT_FOR_RELEASE }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Bump the package version
run: |
sed -i -e "s/^version = .*$/version = \"${{ github.event.inputs.version }}\"/" Cargo.toml
cargo build
- uses: yykamei/actions-git-push@main
with:
commit-message: Bump to ${{ github.event.inputs.version }}
if: github.event.inputs.apply == 'true'
- name: Create a GitHub release and publish the crate on crates.io
run: ./scripts/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
APPLY: ${{ github.event.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: github.event.inputs.apply == 'true'
run: gh release upload "v${{ github.event.inputs.version }}" thwack-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}