blob: 6e6cc21ec25a566d8bb461bb089a6941ffe178de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
name: Cut Release Branch
on:
workflow_dispatch:
inputs:
version:
description: "Release version, e.g. 26.07 (also the release branch name)"
required: true
type: string
next_dev:
description: "Next development version to set on main, e.g. 26.12"
required: true
type: string
permissions:
contents: write
pull-requests: write
issues: write # for creating the backport label
jobs:
cut-release:
name: Cut v${{ github.event.inputs.version }} release branch
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0
- name: Set up Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
# Create the release branch from main and mark release.json as a release
# branch. isReleaseBranch is true only on release branches; main keeps it
# false (bumped below).
- name: Create release branch
env:
VERSION: ${{ github.event.inputs.version }}
run: |
git checkout -b "release/$VERSION" main
jq --arg v "v$VERSION" \
'.release = $v | .isReleaseBranch = true' \
release.json > release.json.tmp
mv release.json.tmp release.json
git add release.json
git commit -m "meta: mark v$VERSION as a release branch"
git push -u origin "release/$VERSION"
# Create the per-release backport label so korthout/backport-action can be
# triggered by 'backport: release/<version>'. See .github/workflows/backport.yml.
- name: Create backport label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
run: |
gh label create "backport: release/$VERSION" \
--color "5319e7" \
--description "Backport this pull request to the $VERSION release branch" \
--force
# Bump main to the next development version and mark it as a
# non-release branch. Opened as a PR rather than pushed directly.
- name: Bump main to next development version
env:
NEXT_DEV: ${{ github.event.inputs.next_dev }}
run: |
git checkout main
jq --arg v "v$NEXT_DEV" \
'.release = $v | .isReleaseBranch = false' \
release.json > release.json.tmp
mv release.json.tmp release.json
- name: Create Pull Request to bump main
uses: peter-evans/create-pull-request@v8
with:
branch: meta/bump-dev-${{ github.event.inputs.next_dev }}
base: main
token: ${{ secrets.GITHUB_TOKEN }}
labels: automated pr
commit-message: "meta: bump development version to v${{ github.event.inputs.next_dev }}"
title: "meta: bump development version to v${{ github.event.inputs.next_dev }}"
body: |
> [!NOTE]
> Automatically generated by the Cut Release Branch workflow after
> branching `${{ github.event.inputs.version }}`.
Sets `release.json` on `main` to the next development version
(`v${{ github.event.inputs.next_dev }}`, `isReleaseBranch: false`).
|