-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.73 KB
/
Copy pathrelease-prepare.yaml
File metadata and controls
80 lines (68 loc) · 2.73 KB
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
# Copyright 2026 NVIDIA CORPORATION
# SPDX-License-Identifier: Apache-2.0
# Release, step 1 of 2 — Prepare Changelog (manual dispatch).
#
# Folds the pending changie fragments (.changes/unreleased/*.yaml) into CHANGELOG.md as a new
# "## [VERSION]" section, clears the fragments, and opens a PR against the branch this workflow
# was dispatched on (main for minors/majors, a v*.* branch for patches).
#
# A maintainer reviews and merges that PR. Merging it triggers release-publish.yaml (step 2),
# which tags the version and creates the GitHub Release.
name: Release — Prepare Changelog
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release, e.g. v0.17.0 (minors/majors from main, patches from a v*.* branch)'
required: true
type: string
permissions:
contents: write
pull-requests: write
jobs:
prepare:
name: Fold changelog & open PR
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.KAIBOT_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: '1.26.3'
- name: Fold fragments into CHANGELOG.md
run: make changelog-release VERSION="${{ inputs.version }}"
- name: Open release PR
env:
GH_TOKEN: ${{ secrets.KAIBOT_TOKEN }}
VERSION: ${{ inputs.version }}
BASE: ${{ github.ref_name }}
run: |
set -euo pipefail
BRANCH="release/prepare-$VERSION"
git config --local user.name "kai-release-bot"
git config --local user.email "action@github.com"
git switch -c "$BRANCH"
git add -A
git commit -s -m "chore(release): prepare changelog for $VERSION"
git push --force-with-lease -u origin "$BRANCH"
BODY="${RUNNER_TEMP:-/tmp}/pr-body.md"
{
echo "Automated by the **Release — Prepare Changelog** workflow."
echo
echo "Folds the pending \`.changes/unreleased/\` fragments into \`CHANGELOG.md\` as \`## [$VERSION]\` and clears them. \`CHANGELOG.md\` is the source of truth."
echo
echo "**Merging this PR** triggers \`release-publish.yaml\`, which tags \`$VERSION\` and creates the GitHub Release from this changelog section."
echo
echo "- Review the new \`## [$VERSION]\` section for accuracy."
echo "- Target branch: \`$BASE\`."
} > "$BODY"
gh pr create \
--base "$BASE" \
--head "$BRANCH" \
--title "chore(release): prepare changelog for $VERSION" \
--label skip-changelog \
--body-file "$BODY"