-
Notifications
You must be signed in to change notification settings - Fork 7
125 lines (104 loc) · 4.01 KB
/
create-release-pr.yaml
File metadata and controls
125 lines (104 loc) · 4.01 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Create Release PR
on:
workflow_dispatch:
inputs:
bump_type:
description: "Type of version bump to apply"
required: true
type: choice
options:
- patch
- minor
- major
concurrency:
group: create-release-pr
cancel-in-progress: false
jobs:
create-release-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App token
id: generate_token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: sourcebot-dev
repositories: sourcebot-helm-chart
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install semver
run: npm install -g semver
- name: Calculate new version
id: calculate_version
run: |
CURRENT_VERSION=$(grep '^version:' charts/sourcebot/Chart.yaml | cut -d ' ' -f 2)
echo "Current chart version: $CURRENT_VERSION"
NEW_VERSION=$(semver -i ${{ inputs.bump_type }} $CURRENT_VERSION)
echo "New chart version: $NEW_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Check if version already exists
run: |
VERSION=${{ steps.calculate_version.outputs.new_version }}
if grep -q "## \[$VERSION\]" CHANGELOG.md; then
echo "Error: Version $VERSION already exists in CHANGELOG.md"
exit 1
fi
- name: Update Chart.yaml version
run: |
sed -i "s/^version: .*/version: ${{ steps.calculate_version.outputs.new_version }}/" charts/sourcebot/Chart.yaml
- name: Update CHANGELOG.md
run: |
VERSION=${{ steps.calculate_version.outputs.new_version }}
DATE=$(date +%Y-%m-%d)
# Insert the new version header after the [Unreleased] line
sed -i "/## \[Unreleased\]/a\\
\\
## [$VERSION] - $DATE" CHANGELOG.md
echo "Updated CHANGELOG.md with version $VERSION"
cat CHANGELOG.md | head -n 20
- name: Install helm-docs
run: |
cd /tmp
curl -L https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | tar xz
sudo mv helm-docs /usr/local/bin/
- name: Update README.md
run: |
cd charts/sourcebot
helm-docs
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.generate_token.outputs.token }}
commit-message: |
chore: release chart v${{ steps.calculate_version.outputs.new_version }}
- Bump chart version from ${{ steps.calculate_version.outputs.current_version }} to ${{ steps.calculate_version.outputs.new_version }}
- Update CHANGELOG.md
- Update generated documentation
title: "chore: release chart v${{ steps.calculate_version.outputs.new_version }}"
body: |
## Summary
Release chart version ${{ steps.calculate_version.outputs.new_version }} (${{ inputs.bump_type }} bump).
## Changes
- 📦 Bump chart version from ${{ steps.calculate_version.outputs.current_version }} to ${{ steps.calculate_version.outputs.new_version }}
- 📝 Update CHANGELOG.md
- 📝 Update generated documentation
---
**Bump type**: `${{ inputs.bump_type }}`
branch: release-chart-v${{ steps.calculate_version.outputs.new_version }}
delete-branch: true
reviewers: |
brendan-kellam
msukkari
labels: |
release