name: Release
on:
push:
tags: ["v*.*.*"]
workflow_dispatch:
permissions:
contents: read
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - id: read
run: |
set -euo pipefail
# Cargo.toml is the single version literal for the CLI, and
# desktop/src-tauri/Cargo.toml for the app; tauri.conf.json omits
# `version` deliberately so it cannot drift from either.
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
desktop=$(sed -n 's/^version = "\(.*\)"/\1/p' desktop/src-tauri/Cargo.toml | head -n1)
if [ "$version" != "$desktop" ]; then
echo "::error::Cargo.toml is $version but desktop/src-tauri/Cargo.toml is $desktop"
exit 1
fi
if [ "${GITHUB_REF_TYPE:-}" = "tag" ] && [ "${GITHUB_REF_NAME#v}" != "$version" ]; then
echo "::error::tag ${GITHUB_REF_NAME} does not match crate version $version"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
build:
needs: version
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
bundles: msi,nsis
archive: zip
- os: macos-14
target: aarch64-apple-darwin
bundles: dmg
archive: tar.gz
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bundles: deb,appimage
archive: tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- name: Install Linux desktop dependencies
if: runner.os == 'Linux'
run: >-
sudo apt-get update &&
sudo apt-get install -y
libwebkit2gtk-4.1-dev
libappindicator3-dev
librsvg2-dev
patchelf
- uses: taiki-e/install-action@7b8d4719ee4aaa279bdf55df38dacb9ebfe12a6c with:
tool: tauri-cli
- name: Build the CLI
run: cargo build --release --bin gitbound
- name: Build the desktop bundles
working-directory: desktop
run: cargo tauri build --bundles ${{ matrix.bundles }}
- name: Package the CLI
id: cli
shell: bash
env:
TARGET: ${{ matrix.target }}
ARCHIVE: ${{ matrix.archive }}
run: |
set -euo pipefail
asset="gitbound-${TARGET}.${ARCHIVE}"
staging="$RUNNER_TEMP/stage"
mkdir -p "$staging"
if [ "$RUNNER_OS" = "Windows" ]; then
cp target/release/gitbound.exe "$staging/"
else
cp target/release/gitbound "$staging/"
fi
cp LICENSE NOTICE README.md "$staging/"
mkdir -p dist
if [ "$ARCHIVE" = "zip" ]; then
( cd "$staging" && 7z a -tzip "$GITHUB_WORKSPACE/dist/$asset" . >/dev/null )
else
tar -czf "dist/$asset" -C "$staging" .
fi
echo "asset=$asset" >> "$GITHUB_OUTPUT"
- name: Collect the desktop bundles
shell: bash
env:
VERSION: ${{ needs.version.outputs.version }}
TARGET: ${{ matrix.target }}
run: |
set -euo pipefail
mkdir -p dist
# The portable executable falls out of the plain cargo build; the rest
# come from the tauri bundler and live under target/release/bundle.
if [ "$RUNNER_OS" = "Windows" ]; then
cp "target/release/gitbound-desktop.exe" "dist/GitBound_${VERSION}_${TARGET}.exe"
else
cp "target/release/gitbound-desktop" "dist/GitBound_${VERSION}_${TARGET}" || true
fi
find target/release/bundle -maxdepth 2 -type f \
\( -name '*.msi' -o -name '*.dmg' -o -name '*.deb' -o -name '*.AppImage' -o -name '*-setup.exe' \) \
-exec cp {} dist/ \;
ls -la dist
- name: Checksum every asset
shell: bash
run: |
set -euo pipefail
cd dist
for file in *; do
case "$file" in *.sha256) continue ;; esac
if command -v sha256sum >/dev/null; then
sha256sum "$file" > "$file.sha256"
else
shasum -a 256 "$file" > "$file.sha256"
fi
done
ls -la
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: dist-${{ matrix.target }}
path: dist/*
if-no-files-found: error
publish:
needs: [version, build]
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with:
pattern: dist-*
merge-multiple: true
path: dist
- name: Attest build provenance
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be with:
subject-path: |
dist/*
!dist/*.sha256
- name: Publish a draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
VERSION: ${{ needs.version.outputs.version }}
run: |
set -euo pipefail
# Drafts, so a human publishes. Release notes come from CHANGELOG.md
# rather than being generated, because the changelog is the thing the
# project actually maintains.
if ! gh release view "v$VERSION" >/dev/null 2>&1; then
gh release create "v$VERSION" --draft --title "GitBound v$VERSION" --notes ""
fi
gh release upload "v$VERSION" dist/* --clobber