name: Release Prepare
run-name: Release Prepare ${{ github.ref_name }}
on:
push:
tags:
- "v*"
concurrency:
group: release-prepare-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
validate-version:
uses: ./.github/workflows/release-validate.yml
with:
ref: ${{ github.ref_name }}
ci:
name: CI Gate
needs: validate-version
uses: ./.github/workflows/test.yml
build-binaries:
name: Build fsck (${{ matrix.label }})
needs: [validate-version, ci]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
label: linux-x64
ext: ""
- runs-on: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
label: linux-arm64
ext: ""
- runs-on: macos-latest
target: aarch64-apple-darwin
label: macos-arm64
ext: ""
- runs-on: macos-latest
target: x86_64-apple-darwin
label: macos-x64
ext: ""
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
label: windows-x64
ext: ".exe"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust + target
uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 with:
prefix-key: fsck-${{ matrix.target }}
- name: Set version from tag
shell: bash
run: bash scripts/ci/stamp_version.sh "${{ needs.validate-version.outputs.version }}"
- name: Build pagedb-fsck
run: cargo build --release --bin pagedb-fsck --target ${{ matrix.target }}
- name: Package (Unix)
if: runner.os != 'Windows'
run: |
set -euo pipefail
cd target/${{ matrix.target }}/release
chmod +x pagedb-fsck
tar czf pagedb-fsck-${{ needs.validate-version.outputs.version }}-${{ matrix.label }}.tar.gz pagedb-fsck
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd target/${{ matrix.target }}/release
$name = "pagedb-fsck-${{ needs.validate-version.outputs.version }}-${{ matrix.label }}.zip"
Compress-Archive -Path "pagedb-fsck${{ matrix.ext }}" -DestinationPath $name
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: fsck-${{ matrix.label }}
path: |
target/${{ matrix.target }}/release/pagedb-fsck-*.tar.gz
target/${{ matrix.target }}/release/pagedb-fsck-*.zip
if-no-files-found: error
retention-days: 14
summary:
name: Release instructions
needs: [validate-version, build-binaries]
runs-on: ubuntu-latest
steps:
- name: Write summary
env:
VERSION: ${{ needs.validate-version.outputs.version }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
{
echo "## Prepared v${VERSION}"
echo
echo "Tests passed and the fsck binaries are built. Publish with:"
echo
echo '```sh'
echo "gh workflow run release.yml -R ${REPO} \\"
echo " -f tag=v${VERSION} \\"
echo " -f prepare_run_id=${RUN_ID}"
echo '```'
echo
echo "If one stage fails, re-run the same command with only the"
echo "remaining stage enabled (e.g. \`-f publish_crate=false\`)."
echo "Nothing is recompiled."
} >> "$GITHUB_STEP_SUMMARY"