Skip to content

Commit 61be611

Browse files
authored
Merge pull request #31 from fleetbase/ci/release-tag-automation
ci(release): tag automatically when a dev-v* branch merges to main
2 parents 86fd73a + fc3151a commit 61be611

3 files changed

Lines changed: 64 additions & 2 deletions

File tree

.github/workflows/create-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ jobs:
1414
with:
1515
tag_name: ${{ github.ref_name }}
1616
name: ${{ github.ref_name }}
17-
generate_release_notes: true
17+
body_path: RELEASE.md
18+
generate_release_notes: true
1819
draft: false
1920
prerelease: false
2021
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release Tag
2+
3+
# Tags a release when a `dev-v*` branch is merged to main, and pushes the tag. Delegates
4+
# to the reusable workflow in fleetbase/fleetbase. Requires org secret _GITHUB_AUTH_TOKEN
5+
# (inherited); no-ops with a warning until it is set.
6+
#
7+
# It pushes the tag and nothing else — create-release.yml and the publish jobs in this
8+
# repository already chain off `push: tags: v*`.
9+
#
10+
# The version is never retyped: it comes from the branch name, and the tag is refused
11+
# unless the files below and RELEASE.md already agree with it. This repository is
12+
# engine-only, so package.json is the single source of the version.
13+
#
14+
# RELEASE.md is required, and its first line must name the version being released. That
15+
# check is the only thing that can tell notes written for this release from the previous
16+
# release's notes nobody replaced.
17+
#
18+
# Deliberately unpinned, like postman.yml — it tracks the reusable workflow on main, so
19+
# there is no ref here to remember to bump.
20+
#
21+
# workflow_dispatch is the recovery path. Use it when a release failed validation and the
22+
# fix landed on main after the merge: re-running the merge event would check out the
23+
# merge commit and never see that fix.
24+
25+
on:
26+
pull_request:
27+
types: [closed]
28+
branches: [main]
29+
workflow_dispatch:
30+
inputs:
31+
version:
32+
description: "Version to tag, e.g. 1.2.3. Recovery only — a normal release reads it from the branch."
33+
required: true
34+
permissions:
35+
contents: read
36+
37+
jobs:
38+
tag:
39+
if: github.event_name == 'workflow_dispatch' ||
40+
(github.event.pull_request.merged == true &&
41+
startsWith(github.event.pull_request.head.ref, 'dev-v'))
42+
uses: fleetbase/fleetbase/.github/workflows/release-tag.yml@main
43+
with:
44+
version-files: package.json
45+
version: ${{ github.event.inputs.version || '' }}
46+
secrets: inherit

RELEASE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
> v0.1.11 ~ "RELEASE_NOTES_PLACEHOLDER — replace this line with the release title"
2+
3+
---
4+
## Highlights
5+
6+
RELEASE_NOTES_PLACEHOLDER
7+
8+
Describe what changed in this release. The first line above must name the version
9+
being released, and both placeholder markers must be gone, or the release workflow
10+
refuses to tag.
11+
12+
---
13+
## Need help?
14+
- [GitHub Discussions](https://github.com/fleetbase/fleetbase/discussions)
15+
- [Discord](https://discord.gg/HnTqQ6zAVn)

0 commit comments

Comments
 (0)