Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/precompile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@ on:
tags: ['v*']

# Every `uses:` below is pinned to a full commit SHA rather than a moving tag.
# This is the workflow that holds HEX_API_KEY, so a retagged action would be a
# supply-chain takeover of the published package. Pinned releases:
# This workflow publishes the package, so a retagged action would be a
# supply-chain takeover of it. Pinned releases:
# actions/checkout v6.1.0 -> d23441a48e516b6c34aea4fa41551a30e30af803
# erlef/setup-beam v1.24.1 -> 54075bcc5e249e4758d363f27d099f55d843f124
# Re-resolve with `git ls-remote https://github.com/<owner>/<repo> 'refs/tags/v*'`
# and take the dereferenced (`^{}`) line when the tag is annotated.
#
# HEX_API_KEY lives in the `hex` environment, not in repository secrets, so
# only the `publish` job can read it. The environment admits `v*` tags only
# and waits for a required reviewer, so nothing reaches Hex without an approval
# after the artifacts and checksums are in place.

# Jobs that need more ask for it themselves.
permissions:
contents: read

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
Expand Down Expand Up @@ -129,6 +138,9 @@ jobs:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
submodules: recursive
# This job builds llama.cpp with contents: write; keep the token out
# of .git. The upload step gets its own GH_TOKEN.
persist-credentials: false
# Before setup-beam, which installs into the tool cache this would remove.
- name: Free disk space for the CUDA toolkit
if: matrix.toolkit != ''
Expand Down Expand Up @@ -382,6 +394,8 @@ jobs:
name: Publish to Hex
runs-on: ubuntu-22.04
needs: [checksum]
# The only job that can read HEX_API_KEY (see the header).
environment: hex
permissions:
contents: read
steps:
Expand All @@ -392,6 +406,9 @@ jobs:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: ${{ github.ref }}
# No git token beside the Hex key. The fetch below is anonymous; the
# repository is public.
persist-credentials: false

- name: Take the generated checksum.exs from master
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Qwen3.8-27B NVFP4 is unchanged (`bench/spark_spec.exs`: plain 14.21, MTP
branches, `draft-ctx-other-devices` is upstream; `rpc-add-server-no-abort`
and `rpc-client-spin-wait` are not and still apply; `cuda-mmq-src1-reuse`
conflicts with #31296 and #31047.
- Release workflow: `HEX_API_KEY` moves from repository secrets to a `hex`
GitHub environment that only the `publish` job declares. The environment
accepts `v*` tags only and needs a reviewer's approval before anything
reaches Hex. The `precompile` and `publish` checkouts no longer leave a git
token in `.git`, and the workflow defaults to `contents: read`.

### Fixed

Expand Down
16 changes: 10 additions & 6 deletions docs/release-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,16 @@ publish. The jobs run in this order:
release out of draft, runs `mix elixir_make.checksum --all`, verifies the
resulting `checksum.exs` has an entry for each of them, and commits it to
`master`.
4. **`publish`** checks out the **tag** (not `master`), takes only `checksum.exs`
from `master`, compiles once to verify the published artifact against those
checksums, and runs `mix hex.publish --yes`.

So there is nothing to do by hand after the tag push. Watch the run; if a leg
fails, the release stays a draft and nothing reaches Hex.
4. **`publish`** runs in the `hex` GitHub environment, the only place
`HEX_API_KEY` lives. The environment accepts `v*` tags only and has a
required reviewer, so the job **waits for approval** (Actions → the run →
*Review deployments*). Approve once the release and `checksum.exs` look
right. It checks out the **tag** (not `master`), takes only `checksum.exs`
from `master`, verifies every published artifact against those checksums,
compiles once, and runs `mix hex.publish --yes`.

The only manual step after the tag push is that approval. Watch the run; if a
leg fails, the release stays a draft and nothing reaches Hex.

If you ever need to publish manually — a workflow outage, say — reproduce what
`publish` does rather than publishing from `master`:
Expand Down