Skip to content

Commit 6d0c3ef

Browse files
authored
Merge pull request #5 from pyTooling/claude/pipeline-and-release
Rename the workflow to 'Pipeline.yml' and release from it
2 parents 3ffda66 + 3050ab5 commit 6d0c3ef

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1616
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1717
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18-
name: Verification of the Synchronize Forks Action
18+
name: Pipeline
19+
run-name: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
1920

2021
on:
2122
push:
23+
# 'TagReleaseCommit' dispatches this workflow on the tag it created; a tag pushed by the automatic GITHUB_TOKEN
24+
# doesn't trigger a workflow on its own.
2225
workflow_dispatch:
2326

2427
jobs:
28+
Prepare:
29+
uses: pyTooling/Actions/.github/workflows/PrepareJob.yml@r8
30+
2531
DryRun:
2632
name: 🐧 Dry-run with a valid configuration
2733
runs-on: ubuntu-26.04
@@ -128,3 +134,35 @@ jobs:
128134
printf "::error title=%s::%s\n" "FailOnError" "The action's outcome is '${OUTCOME}', but 'failure' was expected."
129135
exit 1
130136
fi
137+
138+
# A merge commit on 'main' is a release: tag it with the release pull-request's title and start this pipeline again
139+
# on that tag.
140+
TriggerTaggedRelease:
141+
uses: pyTooling/Actions/.github/workflows/TagReleaseCommit.yml@r8
142+
needs:
143+
- Prepare
144+
- DryRun
145+
- ErrorHandling
146+
- FailOnError
147+
if: needs.Prepare.outputs.is_release_commit == 'true'
148+
permissions:
149+
contents: write # required to create the tag
150+
actions: write # required to start the tagged pipeline
151+
with:
152+
version: ${{ needs.Prepare.outputs.version }}
153+
auto_tag: ${{ needs.Prepare.outputs.is_release_commit }}
154+
secrets: inherit
155+
156+
# The tagged run publishes the release page. Its description is the body of the pull-request that produced the
157+
# tagged merge commit, which 'PublishReleaseNotes' looks up itself.
158+
ReleasePage:
159+
uses: pyTooling/Actions/.github/workflows/PublishReleaseNotes.yml@r8
160+
needs:
161+
- Prepare
162+
- DryRun
163+
- ErrorHandling
164+
- FailOnError
165+
if: needs.Prepare.outputs.is_release_tag == 'true'
166+
with:
167+
tag: ${{ needs.Prepare.outputs.version }}
168+
secrets: inherit

‎README.md‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![GitHub Workflow - Build and Test Status](https://img.shields.io/github/actions/workflow/status/pyTooling/SynchronizeForks/.github%2Fworkflows%2FVerification.yml?branch=dev&logo=githubactions)](https://GitHub.com/pyTooling/SynchronizeForks/actions/workflows/Verification.yml)
1+
[![GitHub Workflow - Build and Test Status](https://img.shields.io/github/actions/workflow/status/pyTooling/SynchronizeForks/.github%2Fworkflows%2FPipeline.yml?branch=dev&logo=githubactions)](https://GitHub.com/pyTooling/SynchronizeForks/actions/workflows/Pipeline.yml)
22
[![Sourcecode License](https://img.shields.io/badge/code-MIT%20License-green?longCache=true&style=flat-square&logoColor=fff)](LICENSE.md)
33

44
# Synchronize Forks
@@ -288,6 +288,25 @@ fields are worth a look while converting: `<upstream>` is reported in the progre
288288
placeholder there makes the log name the wrong repository, and adding tag patterns is what stops the fork from drifting
289289
behind in releases.
290290
291+
## Pipeline
292+
293+
[`Pipeline.yml`](.github/workflows/Pipeline.yml) runs the action against the fixtures in `tests/` in dry-run mode —
294+
three jobs, no token, no repository touched. Beyond that it releases itself, with reusable workflows from
295+
[pyTooling/Actions](https://github.com/pyTooling/Actions):
296+
297+
* **`PrepareJob.yml`** classifies the run — which branch or tag, a regular or a merge commit, a release commit or a
298+
release tag — so the two jobs below know whether they apply.
299+
* **`TagReleaseCommit.yml`** turns a merge commit on `main` into a tag named after the release pull-request's title
300+
(`v1.0.0`), and starts this pipeline again on that tag. A tag pushed with the automatic `GITHUB_TOKEN` doesn't
301+
trigger a workflow, which is why the pipeline is dispatched explicitly — and why this file has to be called
302+
`Pipeline.yml`.
303+
* **`PublishReleaseNotes.yml`** runs on the tagged pipeline, once the same three jobs pass, and publishes the release
304+
page. Its description is the body of the pull-request that produced the tagged merge commit; the workflow finds that
305+
pull-request from the merge commit itself.
306+
307+
So a release is one merge: open a `dev` → `main` pull-request titled `vMM.mm.pp`, write the release notes in its
308+
description, and merge it.
309+
291310
## Dependencies
292311
293312
* [GitHub CLI (`gh`)](https://cli.github.com/), pre-installed on GitHub-hosted runners.

‎tests/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Test Fixtures
22

3-
Configuration files used by [`Verification.yml`](../.github/workflows/Verification.yml). The action is run in dry-run
3+
Configuration files used by [`Pipeline.yml`](../.github/workflows/Pipeline.yml). The action is run in dry-run
44
mode against them, so no repository is synchronized and no token is needed.
55

66
* `Valid` — one organisation, one commented out organisation, four repositories of which one is commented out, and

0 commit comments

Comments
 (0)