From c3282c247649fe424aea0e3da87008d29e8a3878 Mon Sep 17 00:00:00 2001 From: Kailan Blanks Date: Tue, 5 May 2026 16:56:52 +0100 Subject: [PATCH 1/2] Add release process --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++ RELEASING.md | 47 +++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 RELEASING.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..091417c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Verify tag matches crate version + run: | + TAG="${GITHUB_REF#refs/tags/v}" + CRATE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "esi") | .version') + if [ "$TAG" != "$CRATE_VERSION" ]; then + echo "::error::Tag version ($TAG) does not match crate version ($CRATE_VERSION)" + exit 1 + fi + + - name: Authenticate with crates.io + uses: rust-lang/crates-io-auth-action@v1 + id: auth + + - name: Publish to crates.io + run: cargo publish -p esi + env: + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..c1188ce --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,47 @@ +# Releasing + +1. **Create a release branch**: + + ```sh + git checkout main + git pull + git checkout -b release/vX.Y.Z + ``` + +2. **Update the version** in [Cargo.toml](Cargo.toml) under `[workspace.package]`: + + ```toml + [workspace.package] + version = "X.Y.Z" + ``` + +3. **Regenerate the lockfile**: + + ```sh + cargo generate-lockfile + ``` + +4. **Commit and push the version bump**: + + ```sh + git add Cargo.toml Cargo.lock + git commit -m "Release vX.Y.Z" + git push -u origin release/vX.Y.Z + ``` + +5. **Open a pull request** into `main` and get it merged. + +6. **Tag the release from `main`**: + + ```sh + git checkout main + git pull + git tag vX.Y.Z + git push origin vX.Y.Z + ``` + + The tag must match the pattern `vX.Y.Z` and the version in `Cargo.toml`. + +7. **Monitor the release**. The [Release workflow](.github/workflows/release.yml) will automatically verify the tag matches the crate version and publish to [crates.io](https://crates.io/crates/esi). + + You can follow progress in the **Actions** tab of the repository. From 1f65e48d2d6ce95799add5c91a29a07f137db859 Mon Sep 17 00:00:00 2001 From: Kailan Blanks Date: Fri, 29 May 2026 10:03:40 +0100 Subject: [PATCH 2/2] Update release workflow to use reusable workflow --- .github/workflows/release.yml | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 091417c..5f03647 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,30 +7,10 @@ on: jobs: publish: - runs-on: ubuntu-latest permissions: id-token: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - - - name: Verify tag matches crate version - run: | - TAG="${GITHUB_REF#refs/tags/v}" - CRATE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "esi") | .version') - if [ "$TAG" != "$CRATE_VERSION" ]; then - echo "::error::Tag version ($TAG) does not match crate version ($CRATE_VERSION)" - exit 1 - fi - - - name: Authenticate with crates.io - uses: rust-lang/crates-io-auth-action@v1 - id: auth - - - name: Publish to crates.io - run: cargo publish -p esi - env: - CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} + contents: read + uses: fastly/devex-reusable-workflows/.github/workflows/publish-rust-crates-io-v1.yml@main + with: + crate_name: esi + expected_version: ${{ github.ref_name }}