Skip to content

Commit 82b86fb

Browse files
authored
build: create separate release branches for tagged releases on publish (#457)
1 parent a3c435b commit 82b86fb

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/maintainers_guide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ As a maintainer, the development you do will be almost entirely off of your fork
6060

6161
`main` is where active development occurs.
6262

63+
`release/vX.Y.Z` has the packaged distribution of a particular version based from the changes on `main`. This is created using a workflow when new releases are published.
64+
6365
When developing, branches should be created off of your fork and not directly off of this repository. If working on a long-running feature and in collaboration with others, a corresponding branch of the same name is permitted. This makes collaboration on a single branch possible, as contributors working on the same feature cannot push commits to others' open Pull Requests.
6466

6567
After a major version increment, there also may be maintenance branches created specifically for supporting older major versions.

.github/workflows/publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: Publish
22

33
on:
44
release:
5-
types: [published, edited]
5+
types:
6+
- published
7+
- edited
68

79
jobs:
810
build:
@@ -14,7 +16,8 @@ jobs:
1416
- name: Checkout the current code
1517
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1618
with:
17-
persist-credentials: false
19+
fetch-depth: 0
20+
persist-credentials: true
1821
ref: ${{ github.event.release.tag_name }}
1922

2023
- name: Configure the runtime node
@@ -31,8 +34,18 @@ jobs:
3134
run: npm run build
3235

3336
- name: Distribute the latest tagged release
37+
id: tag
3438
uses: teunmooij/github-versioned-release@3edf649c6e5e5e976d43f2584b15bdc8b4c8f0df # v1.2.1
3539
with:
3640
template: javascript-action
3741
env:
3842
GITHUB_TOKEN: ${{ github.token }}
43+
44+
- name: Create a branch for tagged release
45+
run: |
46+
git fetch origin "$SHA"
47+
git checkout -b "release/$TAG" "$SHA"
48+
git push origin "release/$TAG"
49+
env:
50+
TAG: ${{ github.event.release.tag_name }}
51+
SHA: ${{ steps.tag.outputs.sha }}

0 commit comments

Comments
 (0)