Skip to content

Commit 838cd69

Browse files
committed
Combine publish release workflow
1 parent 52fd2ff commit 838cd69

11 files changed

Lines changed: 74 additions & 152 deletions

File tree

.github/workflows/check-builds.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ on:
44
workflow_dispatch:
55
pull_request:
66
branches:
7-
- build-test
87
- main
98
push:
109
branches:
11-
- build-test
1210
- main
1311

1412
jobs:

.github/workflows/check-version.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ on:
55
pull_request:
66
branches:
77
- dev
8-
- build-test
9-
- main
108
push:
119
branches:
1210
- dev
13-
- build-test
14-
- main
1511

1612
jobs:
1713
check-version:

.github/workflows/prepare-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ jobs:
110110
gh pr edit "$branch" \
111111
--repo "$GITHUB_REPOSITORY" \
112112
--title "Release $VERSION" \
113-
--body "Bumps repo-owned release metadata to $VERSION. Merging this PR lets the production branch builder materialize generated outputs and the release-tag workflow create the GitHub tag and draft release."
113+
--body "Bumps repo-owned release metadata to $VERSION. Merging this PR lets the Publish workflow materialize generated outputs, create the GitHub tag, and open a draft release."
114114
else
115115
gh pr create \
116116
--repo "$GITHUB_REPOSITORY" \
117117
--base "$BASE_BRANCH" \
118118
--head "$branch" \
119119
--title "Release $VERSION" \
120-
--body "Bumps repo-owned release metadata to $VERSION. Merging this PR lets the production branch builder materialize generated outputs and the release-tag workflow create the GitHub tag and draft release."
120+
--body "Bumps repo-owned release metadata to $VERSION. Merging this PR lets the Publish workflow materialize generated outputs, create the GitHub tag, and open a draft release."
121121
fi
Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,37 @@
1-
name: Build Test Branch
1+
name: Publish
22

33
on:
44
push:
55
branches:
66
- dev
77
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: Validate and show publish actions without pushing branch, tag, or release.
11+
required: true
12+
default: false
13+
type: boolean
14+
publish:
15+
description: Publish the GitHub Release instead of leaving it as a draft.
16+
required: true
17+
default: false
18+
type: boolean
19+
create_release:
20+
description: Create the GitHub Release after pushing the tag.
21+
required: true
22+
default: true
23+
type: boolean
824

925
permissions:
10-
actions: write
1126
contents: write
1227

1328
concurrency:
14-
group: build-test-branch
29+
group: publish-${{ github.ref_name }}
1530
cancel-in-progress: false
1631

1732
jobs:
18-
build-test:
19-
name: Bundle build-test
33+
publish:
34+
name: Build And Tag
2035
runs-on: ubuntu-latest
2136

2237
steps:
@@ -26,20 +41,17 @@ jobs:
2641
fetch-depth: 0
2742
persist-credentials: false
2843

29-
- name: Configure build-test push credentials
30-
id: push-token
44+
- name: Configure publish credentials
3145
env:
3246
BUILD_TEST_PUSH_TOKEN: ${{ secrets.BUILD_TEST_PUSH_TOKEN }}
3347
GH_TOKEN: ${{ github.token }}
3448
run: |
3549
if [ -n "$BUILD_TEST_PUSH_TOKEN" ]; then
3650
git remote set-url origin "https://x-access-token:${BUILD_TEST_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
37-
echo "Using BUILD_TEST_PUSH_TOKEN for build-test push."
38-
echo "uses_build_test_push_token=true" >> "$GITHUB_OUTPUT"
51+
echo "Using BUILD_TEST_PUSH_TOKEN for publish push."
3952
else
4053
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
41-
echo "Using GITHUB_TOKEN for build-test push."
42-
echo "uses_build_test_push_token=false" >> "$GITHUB_OUTPUT"
54+
echo "Using GITHUB_TOKEN for publish push."
4355
fi
4456
4557
- name: Set up Python
@@ -54,6 +66,7 @@ jobs:
5466

5567
- name: Fetch release comparison refs
5668
run: |
69+
git fetch --tags origin
5770
git fetch --no-tags origin \
5871
main:refs/remotes/origin/main \
5972
build-test:refs/remotes/origin/build-test
@@ -88,33 +101,39 @@ jobs:
88101
run: scripts/test/test.sh
89102

90103
- name: Commit bundle artifacts
91-
id: commit
92104
run: |
93105
git config user.name "github-actions[bot]"
94106
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
95107
git add -A
96108
if git diff --cached --quiet; then
97109
echo "No bundle artifact changes to commit."
98-
echo "committed=false" >> "$GITHUB_OUTPUT"
99110
exit 0
100111
fi
101112
git commit -m "Bundle artifacts for ${GITHUB_SHA}"
102-
echo "committed=true" >> "$GITHUB_OUTPUT"
103113
104114
- name: Push build-test branch
115+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.dry_run == false }}
105116
run: git push --force-with-lease origin HEAD:build-test
106117

107-
- name: Dispatch build-test checks
108-
if: steps.push-token.outputs.uses_build_test_push_token != 'true'
118+
- name: Show dry-run build-test push
119+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
120+
run: echo "Would push HEAD to build-test."
121+
122+
- name: Create release tag and GitHub Release
109123
env:
110124
GH_TOKEN: ${{ github.token }}
125+
INPUT_DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || false }}
126+
INPUT_PUBLISH: ${{ github.event_name == 'workflow_dispatch' && inputs.publish || false }}
127+
INPUT_CREATE_RELEASE: ${{ github.event_name != 'workflow_dispatch' || inputs.create_release }}
111128
run: |
112-
for workflow in test.yml check-builds.yml check-version.yml release-tag.yml; do
113-
curl --fail --show-error --silent \
114-
-X POST \
115-
-H "Authorization: Bearer $GH_TOKEN" \
116-
-H "Accept: application/vnd.github+json" \
117-
-H "X-GitHub-Api-Version: 2022-11-28" \
118-
"https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/dispatches" \
119-
-d '{"ref":"build-test"}'
120-
done
129+
args=(--target HEAD --skip-existing-version)
130+
if [ "$INPUT_DRY_RUN" = "true" ]; then
131+
args+=(--dry-run)
132+
fi
133+
if [ "$INPUT_PUBLISH" = "true" ]; then
134+
args+=(--publish)
135+
fi
136+
if [ "$INPUT_CREATE_RELEASE" != "true" ]; then
137+
args+=(--skip-release)
138+
fi
139+
scripts/release/publish-github-release.sh "${args[@]}"

.github/workflows/release-tag.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
pull_request:
66
branches:
77
- dev
8-
- build-test
98
- main
109
push:
1110
branches:
1211
- dev
13-
- build-test
1412
- main
1513

1614
jobs:

AGENTS.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ Use `main` as the production clone/release branch only.
1616
Normal development work targets `dev` and should not bump release metadata. To
1717
start a release, run the `Prepare Release` workflow from `dev`; it creates a
1818
`release/<version>` branch, updates repo-owned version files, and opens a PR
19-
back to `dev`. After that PR merges, the production-branch builder bundles the
20-
symlinked checkout into real generated outputs and pushes the result to
21-
`build-test` for now, later `main`.
22-
23-
The `Release Tag` workflow runs from that production branch. It checks the
24-
production layout, creates the semver git tag from the repo-owned version, and
25-
opens a draft GitHub Release. Use `scripts/release/bump-version.sh` and
26-
`scripts/release/publish-github-release.sh` only as local/manual fallbacks for
27-
the GitHub workflows.
19+
back to `dev`. After that PR merges, the `Publish` workflow bundles the
20+
symlinked checkout into real generated outputs, validates and tests that
21+
production layout, pushes the result to `build-test` for now, later `main`, then
22+
creates the semver git tag and draft GitHub Release. Use
23+
`scripts/release/bump-version.sh` and `scripts/release/publish-github-release.sh`
24+
only as local/manual fallbacks for the GitHub workflows.
2825

2926
## Repo Map
3027

CONTRIBUTING.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,15 @@ scripts/release/bump-version.sh patch --no-commit
180180
scripts/release/check-version.sh --incremented-from origin/main
181181
```
182182

183-
`build-test` and release branches must be installable from a plain checkout, so
184-
they contain generated production outputs instead of symlinks. The build-test
185-
automation bundles `dev`, validates the production layout, and pushes the
186-
generated result to `build-test`. Treat those generated outputs as CI products,
187-
not edit targets.
188-
189-
PRs opened against `dev` must keep release metadata internally consistent. The
190-
release-tag workflow runs on the production branch, checks the bundled layout,
191-
creates the semver tag from `plugins/cad/VERSION`, and opens a draft GitHub
192-
Release with generated notes. Enable repository tag rulesets for
183+
`build-test` and `main` production branches must be installable from a plain
184+
checkout, so they contain generated production outputs instead of symlinks. The
185+
`Publish` workflow bundles `dev`, validates and tests the production layout,
186+
pushes the generated result to `build-test`, then creates the semver tag from
187+
`plugins/cad/VERSION` and opens a draft GitHub Release with generated notes.
188+
Treat generated outputs as CI products, not edit targets.
189+
190+
PRs opened against `dev` must keep release metadata internally consistent.
191+
Enable repository tag rulesets for
193192
`[0-9]*.[0-9]*.[0-9]*` before publishing from `main`, and enable immutable
194193
releases once the production flow is trusted.
195194

scripts/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,24 @@ scripts/release/bump-version.sh patch --dry-run
110110
scripts/release/bump-version.sh patch --no-commit
111111
```
112112

113-
Use `scripts/release/publish-github-release.sh` only from a production branch or
114-
the `Release Tag` workflow. It creates the semver git tag from
115-
`plugins/cad/VERSION` and creates a draft GitHub Release with generated notes.
113+
Use `scripts/release/publish-github-release.sh` only from the `Publish`
114+
workflow or as a manual production-branch fallback. It creates the semver git
115+
tag from `plugins/cad/VERSION` and creates a draft GitHub Release with
116+
generated notes.
116117
`scripts/release/create-github-release.sh` remains as a manual all-in-one
117118
fallback, but the workflow path is preferred.
118119

119120
## CI
120121

121122
| Workflow | Branches/events | Purpose |
122123
| -------- | --------------- | ------- |
123-
| `test.yml` | pushes to `dev`, `build-test`, `main`; PRs to those branches | Runs the broad code test wrapper. |
124-
| `check-version.yml` | pushes to `dev`, `build-test`, `main`; PRs to those branches | Verifies repo-owned release metadata is internally consistent. |
124+
| `test.yml` | pushes to `dev` and `main`; PRs to those branches | Runs the broad code test wrapper. |
125+
| `check-version.yml` | pushes to `dev`; PRs targeting `dev`; manual dispatch | Verifies repo-owned release metadata is internally consistent before release publishing. |
125126
| `check-symlinks.yml` | pushes to `dev`; PRs targeting `dev` | Verifies the development checkout keeps generated-copy paths symlinked to source. |
126-
| `check-builds.yml` | pushes to `build-test` and `main`; PRs targeting those branches | Verifies production branches contain bundled generated outputs instead of symlinks. |
127+
| `check-builds.yml` | pushes to `main`; PRs targeting `main`; manual dispatch | Verifies production branches contain bundled generated outputs instead of symlinks. |
127128
| `prepare-release.yml` | manual dispatch from `dev` | Bumps version metadata on `release/<version>` and opens a release PR back to `dev`. |
128-
| `build-test-branch.yml` | pushes to `dev`; manual dispatch | Temporary release builder that bundles `dev` and pushes production output to `build-test`; this will target `main` once trusted. |
129-
| `release-tag.yml` | pushes to `build-test`; manual dispatch | Temporary production release workflow that tags the bundled commit and creates a draft GitHub Release; this will target `main` once trusted. |
129+
| `publish.yml` | pushes to `dev`; manual dispatch | Bundles `dev`, validates and tests the production layout, pushes `build-test`, then creates or verifies the semver tag and draft GitHub Release. This will target `main` once trusted. |
130130

131131
In short: `dev` is the editable symlink branch, `build-test` is the temporary
132-
production-output proving branch, and `main` is the eventual production branch
133-
for user clones and published releases.
132+
production-output branch written by `Publish`, and `main` is the eventual
133+
production branch for user clones and published releases.

scripts/release/bump-version.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Usage:
1313
scripts/release/bump-version.sh --check-incremented-from REF
1414
1515
First-class release bump wrapper. By default, a bump writes version metadata
16-
only. Release tags are created by the GitHub release-tag workflow from a
17-
production branch.
16+
only. Release tags are created by the GitHub Publish workflow after production
17+
outputs are bundled.
1818
1919
Common options:
2020
--dry-run Show planned edits and git actions without changing files.

0 commit comments

Comments
 (0)