Skip to main content

GitHub Actions

Automate releases with GitHub Actions

The tj-smith47/anodizer-action composite action is the recommended way to run anodizer in GitHub Actions. It installs anodizer (cached per version), parses .anodizer.yaml to auto-install pipeline dependencies (nfpm, cosign, zig, cargo-zigbuild, upx, snapcraft, rpmbuild, ...), imports signing keys, logs in to container registries, and handles split/merge artifact plumbing — all in one step.

For the complete list of inputs and outputs, see anodizer-action reference.

Basic release

# not an anodizer config
name: Release

on:
  push:
    tags: ["v*"]

permissions:
  contents: write
  actions: read    # required for the cross-workflow artifact download path

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0    # full history for changelog generation

      - uses: tj-smith47/anodizer-action@v1
        with:
          auto-install: true
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

That one step is the whole release job. Before any stage runs, anodizer verifies the environment with a config-derived preflight (required tools, secrets, key material, endpoints), and on a pipeline failure it leaves everything exactly where it stopped — on_failure: hold is the only accepted behavior. Recover by re-running the identical anodizer release command; publishers converge and publish nothing twice. No workflow-level rollback step is needed:

# .anodizer.yaml
release:
  on_failure: hold   # the only accepted value; also the default

auto-install: true reads .anodizer.yaml and installs whatever the configured stages need. To name dependencies explicitly, replace it with install: nfpm,cosign,zig,....

With signing keys

# not an anodizer config
- uses: tj-smith47/anodizer-action@v1
  with:
    auto-install: true
    gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
    cosign-key: ${{ secrets.COSIGN_KEY }}
    args: release --clean
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
    COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}

The preflight parses every configured key (GPG, cosign, SSH) before any stage runs, so a truncated or newline-mangled CI secret aborts the release before a publisher can fail halfway through.

Auto-tag on push to main

Run anodizer tag --push on every push to the default branch (--push pushes the tag to the remote — a bare tag stays local). Use a PAT (not GITHUB_TOKEN) so the pushed tag triggers downstream tag-scoped workflows like release.yml:

# not an anodizer config
name: CI

on:
  push:
    branches: [main]

jobs:
  tag:
    # Skip when the commit message contains #none
    if: "!contains(github.event.head_commit.message, '#none')"
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
          # PAT (not GITHUB_TOKEN) so the tag push triggers release.yml.
          token: ${{ secrets.GH_PAT }}

      - name: Configure git identity
        run: |
          git config user.name  "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"

      - uses: tj-smith47/anodizer-action@v1
        with:
          args: tag --push
        env:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }}

anodizer tag is fully local by default; --push is what advances the branch and pushes the tag to the remote (atomically) so release.yml fires. The tag command reads commit messages for #major / #minor / #patch / #none directives, finds the latest semver tag for the crate, bumps accordingly, and pushes the new tag. See Auto-Tagging for details.

Workspace-aware auto-tag (monorepo)

For multi-crate workspaces, tag each crate independently so each gets its own release.yml run. install-only: true installs the binary to PATH without running anodizer — you drive the loop yourself:

# not an anodizer config
      - uses: tj-smith47/anodizer-action@v1
        with:
          install-only: true

      - name: Auto-tag all workspaces
        env:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }}
        run: |
          for crate in my-core my-cli my-operator; do
            echo "--- tagging $crate ---"
            # --push pushes the bump commit + tag atomically; without it the
            # tag stays local and release.yml never fires.
            if anodizer tag --crate "$crate" --push; then
              echo "::notice::$crate: tagged"
            else
              echo "::warning::$crate: skipped or failed"
            fi
          done

Each crate uses its own tag_template (e.g., my-core-v{{ Version }}) for both lookup and creation, so tags never collide across workspaces.

Tag-triggered monorepo release

When a tag arrives, resolve it to its owning crate and release only that crate. resolve-workspace: true populates the workspace, crate-path, and has-builds outputs from the triggering tag:

# not an anodizer config
name: Release

on:
  push:
    tags:
      - "v*"
      - "*-v*"

permissions:
  contents: write
  packages: write

jobs:
  resolve:
    runs-on: ubuntu-latest
    outputs:
      crate: ${{ steps.a.outputs.workspace }}
      has-builds: ${{ steps.a.outputs.has-builds }}
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: tj-smith47/anodizer-action@v1
        id: a
        with:
          resolve-workspace: true
          install-only: true

  release:
    needs: resolve
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: tj-smith47/anodizer-action@v1
        with:
          auto-install: true
          docker-registry: ghcr.io
          docker-password: ${{ secrets.GITHUB_TOKEN }}
          gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
          args: release --crate ${{ needs.resolve.outputs.crate }} --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}

CI-built anodizer binary reuse across workflows

When you have a separate ci.yml that builds and uploads an anodizer binary per commit, downstream release jobs can reuse it without reinstalling. Set artifact-run-id: auto to resolve the run from the current commit SHA:

# not an anodizer config
# ci.yml — builds and uploads anodizer once per commit
- uses: actions/upload-artifact@v4
  with:
    name: anodizer-linux
    path: target/release/anodizer

# release.yml — reuses the ci.yml artifact
- uses: tj-smith47/anodizer-action@v1
  with:
    from-artifact: anodizer-linux
    artifact-run-id: auto
    artifact-workflow: ci.yml
    auto-install: true
    args: release --clean
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This avoids a cold cargo install on every release run.

Manual install (no action)

If you can't use the action (e.g., a self-hosted environment that can't pull from the Marketplace), install anodizer directly. You'll need to handle dependencies and key imports yourself.

# not an anodizer config
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo install anodizer
- run: anodizer release --clean
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Job summary

Inside GitHub Actions, anodizer release appends what the run published to the job summary page, so the outcome of a release can be read without opening its logs. There is nothing to configure: anodizer appends to the file named by the GITHUB_STEP_SUMMARY environment variable, which GitHub Actions sets for every step.

Each published thing becomes one bullet, with a link when there is one:

- Published v1.2.3 to `acme/app` with 12 assets: https://github.com/acme/app/releases/tag/v1.2.3
- Pushed image `ghcr.io/acme/app:1.2.3`
- Signed image `ghcr.io/acme/app:1.2.3`
- Updated homebrew `app` in `https://github.com/acme/homebrew-tap`
- Opened pull request to `acme/scoop-bucket` (scoop manifest `app`): https://github.com/acme/scoop-bucket/pull/7
- Opened pull request to `Homebrew/homebrew-core` (homebrew formula `app` 1.2.3): https://github.com/Homebrew/homebrew-core/pull/12
- Opened pull request to `microsoft/winget-pkgs` (winget package `Acme.App` 1.2.3) from `acme:Acme.App-1.2.3`: https://github.com/microsoft/winget-pkgs/pull/9
- Published `@acme/app@1.2.3` to npm (https://registry.npmjs.org)
- Published `app` 1.2.3 to crates.io
- Uploaded 6 files to https://upload.pypi.org/legacy/
- Pushed `app` 1.2.3 to Chocolatey
- Pushed AUR package `app-bin` to `ssh://aur@aur.archlinux.org/app-bin.git`
- Uploaded 8 objects to `s3://my-bucket`
- Ran custom publisher `mirror` on 8 artifacts

A tap publisher (homebrew, scoop, nix) that pushed straight to its repository reports Updated <kind> <name> in <repo>, where the kind is homebrew for a tap push whether it carried a formula, a cask or both, scoop manifest or nix package; one that opened a pull request reports the upstream repository and the pull request's URL. The winget, krew, homebrew-core and SchemaStore publishers always open a pull request and append its URL when the transport named one (gh pr create prints it; the REST API returns it). An image is listed as signed only after docker_signs: attached its signature and, where verify: is on, verified it.

A bullet is written only for an action that completed, read off the same run report anodizer tag rollback consumes: the forge release (with its asset count and URL), pull requests opened and taps updated by the package-manager publishers, packages pushed to npm, crates.io, PyPI, Chocolatey, the Snap Store, GemFury and Cloudsmith, container images pushed, files uploaded to blob storage, Artifactory and HTTP upload targets, MCP registry entries, SchemaStore registrations, Docker Hub descriptions and every custom publishers: entry that ran. A publisher that failed after pushing part of its work still lists the part that is live.

Nothing is written when GITHUB_STEP_SUMMARY is unset or empty, so runs outside GitHub Actions produce no extra output. Nothing is written either on --dry-run, on --snapshot, for a publisher that was skipped (already published, deselected, gated) or for a draft release, which nobody can download from until it is published by hand. GitLab has no draft state, so a GitLab release is reported whatever release.draft says.

See also