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
16 changes: 8 additions & 8 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
label:
description: The release's label, such as v1.4.0, or auto for the one chant release next computes
description: The release's label, a bare version such as 1.4.0 since the tag template adds any v (one leading v is dropped), or auto for the one chant release next computes
required: true
type: string
permissions:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
- id: green
run: |
commit="$GITHUB_SHA"
label="$CHANT_RELEASE_LABEL"; if [ "$label" = auto ]; then rc=0; git ls-remote --exit-code --heads origin chant/lifecycle >/dev/null || rc=$?; if [ "$rc" = 0 ]; then git fetch origin chant/lifecycle:chant/lifecycle; elif [ "$rc" != 2 ]; then exit "$rc"; fi; next="$(npx --yes @intentius/chant@0.124.105 release next --at "$commit" --json)" || { echo "release next found no label for $commit, so no release is cut: $next" >&2; exit 1; }; label="$(printf '%s' "$next" | node -e 'const f=process.argv[1];const t=f?require("fs").readFileSync(f,"utf8"):require("fs").readFileSync(0,"utf8");const d=JSON.parse(t);process.stdout.write(String(d.label??""))')"; fi
label="$CHANT_RELEASE_LABEL"; if [ "$label" = auto ]; then rc=0; git ls-remote --exit-code --heads origin chant/lifecycle >/dev/null || rc=$?; if [ "$rc" = 0 ]; then git fetch origin chant/lifecycle:chant/lifecycle; elif [ "$rc" != 2 ]; then exit "$rc"; fi; next="$(npx --yes @intentius/chant@0.124.107 release next --at "$commit" --json)" || { echo "release next found no label for $commit, so no release is cut: $next" >&2; exit 1; }; label="$(printf '%s' "$next" | node -e 'const f=process.argv[1];const t=f?require("fs").readFileSync(f,"utf8"):require("fs").readFileSync(0,"utf8");const d=JSON.parse(t);process.stdout.write(String(d.label??""))')"; fi
echo "commit=$commit" >> "$GITHUB_OUTPUT"
echo "label=$label" >> "$GITHUB_OUTPUT"
cut:
Expand Down Expand Up @@ -71,18 +71,18 @@ jobs:
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
with:
platforms: "arm64"
- run: npx --yes @intentius/chant@0.124.105 release doctor --from cut
- run: npx --yes @intentius/chant@0.124.107 release doctor --from cut
- name: goreleaser v2.19.0
run: "mkdir -p \"$RUNNER_TEMP/goreleaser\" && curl -fsSL -o \"$RUNNER_TEMP/goreleaser/goreleaser.tar.gz\" https://github.com/goreleaser/goreleaser/releases/download/v2.19.0/goreleaser_Linux_x86_64.tar.gz && echo \"ebc3194ad1d1b1787614405285a0039665cd4c5bd3305215a1b201600f90630b $RUNNER_TEMP/goreleaser/goreleaser.tar.gz\" | sha256sum -c - && tar -xzf \"$RUNNER_TEMP/goreleaser/goreleaser.tar.gz\" -C \"$RUNNER_TEMP/goreleaser\" goreleaser && echo \"CHANT_GORELEASER=$RUNNER_TEMP/goreleaser/goreleaser\" >> \"$GITHUB_ENV\""
- run: git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'
- run: rc=0; git ls-remote --exit-code --heads origin chant/lifecycle >/dev/null || rc=$?; if [ "$rc" = 0 ]; then git fetch origin chant/lifecycle:chant/lifecycle; elif [ "$rc" != 2 ]; then exit "$rc"; fi
- run: |
git config user.name "chant release"
git config user.email "chant-release@localhost"
npx --yes @intentius/chant@0.124.105 release cut "$CHANT_RELEASE_LABEL" --at "$CHANT_RELEASE_COMMIT" --yes --json > "$RUNNER_TEMP/chant-cut.json"
npx --yes @intentius/chant@0.124.107 release cut "$CHANT_RELEASE_LABEL" --at "$CHANT_RELEASE_COMMIT" --yes --json > "$RUNNER_TEMP/chant-cut.json"
tag="$(node -e 'const f=process.argv[1];const t=f?require("fs").readFileSync(f,"utf8"):require("fs").readFileSync(0,"utf8");const d=JSON.parse(t);process.stdout.write(String(d.tag?.name??""))' "$RUNNER_TEMP/chant-cut.json")"
if [ -n "$tag" ]; then git push origin "refs/tags/$tag"; fi
- run: npx --yes @intentius/chant@0.124.105 release artifacts "$CHANT_RELEASE_LABEL" --no-build -o "$RUNNER_TEMP/chant-release-artifacts"
- run: npx --yes @intentius/chant@0.124.107 release artifacts "$CHANT_RELEASE_LABEL" --no-build -o "$RUNNER_TEMP/chant-release-artifacts"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: chant-release-artifacts
Expand Down Expand Up @@ -132,11 +132,11 @@ jobs:
with:
name: chant-release-images
path: build/images
- run: npx --yes @intentius/chant@0.124.105 release images "$CHANT_RELEASE_LABEL" --no-build -o "$RUNNER_TEMP/chant-release-digests.json"
- run: npx --yes @intentius/chant@0.124.107 release images "$CHANT_RELEASE_LABEL" --no-build -o "$RUNNER_TEMP/chant-release-digests.json"
- run: echo "CHANT_RELEASE_DIGESTS=$RUNNER_TEMP/chant-release-digests.json" >> "$GITHUB_ENV"
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: chant-release-artifacts
path: ${{ runner.temp }}/chant-release-artifacts
- run: npx --yes @intentius/chant@0.124.105 release artifacts "$CHANT_RELEASE_LABEL" --from "$RUNNER_TEMP/chant-release-artifacts"
- run: npx --yes @intentius/chant@0.124.105 release publish "$CHANT_RELEASE_LABEL" --yes
- run: npx --yes @intentius/chant@0.124.107 release artifacts "$CHANT_RELEASE_LABEL" --from "$RUNNER_TEMP/chant-release-artifacts"
- run: npx --yes @intentius/chant@0.124.107 release publish "$CHANT_RELEASE_LABEL" --yes
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ release:
git pull --ff-only origin main
@grep -q "## \[$(V)\]" CHANGELOG.md || { echo "CHANGELOG.md has no '## [$(V)]' section"; exit 1; }
go build ./... && go vet ./... && test -z "$$(gofmt -l .)" && go test ./...
gh workflow run release.yml --repo INTENTIUS/mudflaps --ref main -f label=$(V)
gh workflow run publish.yml --repo INTENTIUS/mudflaps --ref main -f label=$(V)
10 changes: 5 additions & 5 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Releasing

mudflaps releases with [`chant release`](https://intentius.io/chant/cli/release/).
A release is started by hand: the [Release workflow](.github/workflows/release.yml)
A release is started by hand: the [Release workflow](.github/workflows/publish.yml)
picks the newest green commit of `main`, cuts it as `vX.Y.Z`, and publishes:

- a GitHub Release `vX.Y.Z` with the GoReleaser archives for linux, darwin and
Expand All @@ -17,10 +17,10 @@ file by digest, and pushes the tag. The publish job then uploads exactly those
files and that image. Tags stay `vX.Y.Z`; the `v*` tags from before chant are
read as the release history.

`release.yml` is generated: change `chant.config.json`, then regenerate it with
`publish.yml` is generated: change `chant.config.json`, then regenerate it with

```sh
npx --yes @intentius/chant@0.124.105 release workflow --force
npx --yes @intentius/chant@0.124.107 release workflow --force
```

## Steps
Expand All @@ -32,7 +32,7 @@ npx --yes @intentius/chant@0.124.105 release workflow --force
2. **Check the label** (optional). From a clean, up-to-date `main`:

```sh
npx --yes @intentius/chant@0.124.105 release next # the label the commits give
npx --yes @intentius/chant@0.124.107 release next # the label the commits give
```

3. **Start the release:**
Expand All @@ -44,7 +44,7 @@ npx --yes @intentius/chant@0.124.105 release workflow --force
The recipe refuses to proceed unless the working tree is clean, you are on
`main`, the changelog has a `## [X.Y.Z]` section, and `build`/`vet`/`gofmt`/
`test` all pass. It then dispatches the Release workflow with the label
`X.Y.Z`. `gh workflow run release.yml -f label=auto` takes the label from the
`X.Y.Z`. `gh workflow run publish.yml -f label=auto` takes the label from the
commits instead.

4. **Watch the release build:**
Expand Down
2 changes: 1 addition & 1 deletion chant.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
],
"workflow": {
"trigger": "dispatch",
"file": ".github/workflows/release.yml"
"file": ".github/workflows/publish.yml"
}
}
}
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ release version:
[ -z "$(gofmt -l .)" ] || { echo "✗ gofmt reported files"; exit 1; }
go test ./...
echo "→ dispatching the Release workflow for {{version}}"
gh workflow run release.yml --repo INTENTIUS/mudflaps --ref main -f label={{version}}
gh workflow run publish.yml --repo INTENTIUS/mudflaps --ref main -f label={{version}}
echo "✓ dispatched; chant cuts v{{version}} from the newest green commit of main and publishes it."
echo " watch: gh run watch --repo INTENTIUS/mudflaps"
Loading