Skip to content

Release v0.1.0-beta.3 #1

Release v0.1.0-beta.3

Release v0.1.0-beta.3 #1

Workflow file for this run

# Manual distribution workflow. Push a v* tag first; `Release Prepare` runs the
# test suite and builds the fsck binaries. Then run this workflow with that tag
# and the successful prepare run ID.
#
# The GitHub Release consumes the prepare run's artifacts, so a failed publish
# or release stage is retried by re-dispatching with only that stage enabled —
# the tests and the binaries are never rebuilt to fix a crates.io timeout or a
# bad release body.
#
# Stages:
# publish_crate -> crates.io (single crate; verifying publish)
# github_release -> GitHub Release with the fsck binaries attached
#
# Each stage is idempotent: an already-indexed version is skipped, the release
# is overwritten in place. Re-running is safe.
#
# Required secret: CARGO_REGISTRY_TOKEN.
name: Release
run-name: Release ${{ inputs.tag }}
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish, e.g. v0.1.0"
required: true
type: string
prepare_run_id:
description: "Successful Release Prepare run ID holding the binaries"
required: true
type: string
publish_crate:
description: "Publish pagedb to crates.io"
type: boolean
default: true
github_release:
description: "Create the GitHub Release"
type: boolean
default: true
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
# Always runs. Cheap, and it guarantees the dispatched tag still means what
# the prepare run assumed it meant.
validate-version:
uses: ./.github/workflows/release-validate.yml
with:
ref: ${{ inputs.tag }}
# ── crates.io ────────────────────────────────────────────────────────────────
# pagedb is a single leaf crate — no publish-order tiers. A verifying publish
# (no --no-verify) is the strongest guarantee the uploaded tarball builds from
# a clean checkout, and there is no inter-crate index race to skip it for.
publish-crate:
name: Publish to crates.io
needs: validate-version
if: inputs.publish_crate
runs-on: ubuntu-latest
environment: crates.io
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.tag }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# The verifying publish compiles the packaged lib + the pagedb-fsck bin
# against crates.io deps. The io-uring VFS backend needs nothing extra,
# but clang/libclang keeps parity with the test image in case a future
# build-dep needs bindgen.
- name: Install LLVM/Clang
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang libclang-dev
- name: Set version from tag
run: bash scripts/ci/stamp_version.sh "${{ needs.validate-version.outputs.version }}"
- name: Publish pagedb
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail
VERSION=$(cargo metadata --no-deps --format-version=1 \
| jq -r '.packages[] | select(.name == "pagedb") | .version')
is_published() {
curl -sf \
-H "User-Agent: pagedb-ci (github.com/nodedb-lab/pagedb)" \
"https://crates.io/api/v1/crates/pagedb/$1" > /dev/null 2>&1
}
if is_published "$VERSION"; then
echo "pagedb@$VERSION already published — skipping"
exit 0
fi
echo "Publishing pagedb@$VERSION..."
# --allow-dirty: stamp_version.sh may have edited Cargo.toml for a
# prerelease tag; the verifying publish still runs.
cargo publish -p pagedb --allow-dirty
# ── GitHub Release ───────────────────────────────────────────────────────────
# Independent of publish-crate: a crates.io outage must not block cutting the
# release, and re-running this stage alone is the fix for a bad release body.
github-release:
name: Create GitHub Release
needs: validate-version
if: inputs.github_release
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.tag }}
fetch-depth: 0
- name: Download fsck artifacts
uses: actions/download-artifact@v8
with:
pattern: "fsck-*"
run-id: ${{ inputs.prepare_run_id }}
github-token: ${{ github.token }}
path: ./artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ inputs.tag }}
name: pagedb ${{ needs.validate-version.outputs.version }}
generate_release_notes: true
draft: false
prerelease: ${{ needs.validate-version.outputs.is_full_release != 'true' }}
files: artifacts/*
fail_on_unmatched_files: true