Skip to content

Commit 34d9bcf

Browse files
committed
✨ feat(mise): refresh cooled release pin
Use mise-action's signed checksum verification before recording the binary digest. Keep the seven-day cutoff in shared code so callers cannot lower it.
1 parent 13c5d50 commit 34d9bcf

5 files changed

Lines changed: 587 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,35 @@ changes release inputs, including a workspace member's `pyproject.toml` or a sec
152152
formatting job runs `prek`; the writer checks patch paths and modes. Its `changed` output is `true` only when the
153153
refresh produces a patch. Neither mode pushes a branch or requests a write token.
154154

155+
## Refresh a pinned mise binary
156+
157+
`refresh-mise-pin` updates one named `jdx/mise-action` step in a release workflow. It selects the newest stable mise
158+
GitHub Release published at least seven days ago, installs that version through the pinned mise Action, and compares the
159+
installed executable with the release asset digest. The mise Action verifies the download against mise's minisign-signed
160+
checksum file. The refresh Action fails if the named step is missing or duplicated, its version or digest is not
161+
literal, or the installed binary differs from the selected release. It changes only that step's `version` and `sha256`
162+
values and leaves the verified mise executable on `PATH` for the next step.
163+
164+
Call it in a read-only Ubuntu job after checkout. `workflow` is the path under `.github/workflows`; `step-name` is the
165+
exact name of the mise step in that file. `github-token` needs public release read access. `changed` is `true` only when
166+
the two pins change; `version` omits the leading `v`, and `sha256` is the Linux x64 executable digest. The Action does
167+
not update `mise.lock` or open a PR.
168+
169+
```yaml
170+
- uses: tox-dev/github-workflows/refresh-mise-pin@SHA
171+
id: mise
172+
with:
173+
workflow: .github/workflows/release.yaml
174+
step-name: 🔧 Set up mise (JDKs)
175+
github-token: ${{ github.token }}
176+
- name: Refresh locked JDKs
177+
run: mise lock --bump --minimum-release-age 7d
178+
```
179+
180+
Include `.github/workflows/release.yaml` and `mise.lock` in the updater's artifact and App writer path allowlists. The
181+
writer should run in a separate job; this Action does not request its token. The seven-day cutoff is fixed and cannot be
182+
lowered by an input.
183+
155184
The weekly updater freezes eligible hook revisions with `prek update --freeze --cooldown-days 7`. It then uses
156185
`release-creator hooks` to pin Python hook dependencies under the same cutoff and writes a patch when
157186
`.pre-commit-config.yaml` changes. The generation job has read-only repository permissions; the separate publish job

‎changelog.d/+mise-pin.feature.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a keyless Action to refresh the signed mise binary pin after its GitHub Release has aged seven days.

‎refresh-mise-pin/action.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Refresh mise release pin
2+
description: Update a release workflow to a seven-day-old, signature-verified mise binary
3+
inputs:
4+
workflow:
5+
description: Repository-relative workflow containing the pinned mise step
6+
required: true
7+
step-name:
8+
description: Exact name of the mise setup step in that workflow
9+
required: true
10+
github-token:
11+
description: Token with read access to public GitHub releases
12+
required: true
13+
outputs:
14+
changed:
15+
description: Whether the workflow's mise version or digest changed
16+
value: ${{ steps.update.outputs.changed }}
17+
version:
18+
description: Selected mise version without the v prefix
19+
value: ${{ steps.update.outputs.version }}
20+
sha256:
21+
description: SHA256 of the verified Linux x64 mise executable
22+
value: ${{ steps.update.outputs.sha256 }}
23+
runs:
24+
using: composite
25+
steps:
26+
- name: List upstream releases
27+
shell: bash
28+
env:
29+
GH_TOKEN: ${{ inputs.github-token }}
30+
run: |
31+
gh api --paginate \
32+
--jq '.[] | {tag_name,published_at,prerelease,draft,assets:[.assets[] |
33+
select(.name | endswith("-linux-x64")) | {name,digest}]} | @json' \
34+
'repos/jdx/mise/releases?per_page=100' >"$RUNNER_TEMP/mise-releases.jsonl"
35+
- name: Select seven-day-old release
36+
id: select
37+
shell: bash
38+
run: |
39+
python3 "$GITHUB_ACTION_PATH/../tools/refresh_mise_pin.py" select \
40+
"$RUNNER_TEMP/mise-releases.jsonl" "$GITHUB_OUTPUT"
41+
- name: Install signature-verified mise
42+
uses: jdx/mise-action@08ae2a091c038e1e05ec6f5115dc5c69d5a2a6b8 # v5.1.2
43+
with:
44+
version: ${{ steps.select.outputs.version }}
45+
mise_dir: ${{ runner.temp }}/refresh-mise-pin
46+
cache: "false"
47+
install: "false"
48+
env: "false"
49+
export_path: "false"
50+
add_shims_to_path: "false"
51+
- name: Update the workflow pin
52+
id: update
53+
shell: bash
54+
env:
55+
WORKFLOW: ${{ inputs.workflow }}
56+
STEP_NAME: ${{ inputs.step-name }}
57+
VERSION: ${{ steps.select.outputs.version }}
58+
EXPECTED_SHA256: ${{ steps.select.outputs.sha256 }}
59+
run: |
60+
python3 "$GITHUB_ACTION_PATH/../tools/refresh_mise_pin.py" update \
61+
"$WORKFLOW" "$STEP_NAME" "$VERSION" "$EXPECTED_SHA256" \
62+
"$RUNNER_TEMP/refresh-mise-pin/bin/mise" "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)