-
Notifications
You must be signed in to change notification settings - Fork 6
132 lines (112 loc) · 5.07 KB
/
update-sourcebot-version.yaml
File metadata and controls
132 lines (112 loc) · 5.07 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
126
127
128
129
130
131
name: Update Sourcebot Version
on:
schedule:
- cron: '0 9 * * 1' # Run every Monday at 9 AM UTC
workflow_dispatch: # Allow manual triggering
workflow_call: # Allow calling from other workflows
jobs:
check-and-update:
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:
repository: sourcebot-dev/sourcebot-helm-chart
token: ${{ steps.generate_token.outputs.token }}
- name: Get current Sourcebot version
id: current-version
run: |
CURRENT_VERSION=$(grep 'appVersion:' charts/sourcebot/Chart.yaml | cut -d ' ' -f 2 | tr -d '"')
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current Sourcebot version: $CURRENT_VERSION"
- name: Get latest Sourcebot release
id: latest-version
run: |
LATEST_VERSION=$(curl -s https://api.github.com/repos/sourcebot-dev/sourcebot/releases/latest | jq -r '.tag_name')
echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT
echo "Latest Sourcebot version: $LATEST_VERSION"
- name: Compare versions
id: version-check
run: |
if [ "${{ steps.current-version.outputs.current }}" != "${{ steps.latest-version.outputs.latest }}" ]; then
echo "needs_update=true" >> $GITHUB_OUTPUT
echo "New version available: ${{ steps.latest-version.outputs.latest }}"
else
echo "needs_update=false" >> $GITHUB_OUTPUT
echo "Already up to date"
fi
- name: Setup Node.js
if: steps.version-check.outputs.needs_update == 'true'
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install semver
if: steps.version-check.outputs.needs_update == 'true'
run: npm install -g semver
- name: Update Chart.yaml
if: steps.version-check.outputs.needs_update == 'true'
id: update-chart
run: |
# Get current chart version
CURRENT_CHART_VERSION=$(grep '^version:' charts/sourcebot/Chart.yaml | cut -d ' ' -f 2)
echo "Current chart version: $CURRENT_CHART_VERSION"
# Increment patch version
NEW_CHART_VERSION=$(semver -i patch $CURRENT_CHART_VERSION)
echo "New chart version: $NEW_CHART_VERSION"
# Update Chart.yaml
sed -i "s/^version: .*/version: $NEW_CHART_VERSION/" charts/sourcebot/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: ${{ steps.latest-version.outputs.latest }}/" charts/sourcebot/Chart.yaml
echo "chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT
- name: Install helm-docs
if: steps.version-check.outputs.needs_update == 'true'
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
if: steps.version-check.outputs.needs_update == 'true'
run: |
cd charts/sourcebot
helm-docs
- name: Create Pull Request
if: steps.version-check.outputs.needs_update == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.generate_token.outputs.token }}
commit-message: |
chore: bump sourcebot to ${{ steps.latest-version.outputs.latest }}
- Update appVersion to ${{ steps.latest-version.outputs.latest }}
- Bump chart version to ${{ steps.update-chart.outputs.chart_version }}
- Update generated documentation
title: "chore: bump sourcebot to ${{ steps.latest-version.outputs.latest }}"
body: |
## Summary
This PR updates Sourcebot to version ${{ steps.latest-version.outputs.latest }}.
## Changes
- ⬆️ Update appVersion from ${{ steps.current-version.outputs.current }} to ${{ steps.latest-version.outputs.latest }}
- 📦 Bump chart version to ${{ steps.update-chart.outputs.chart_version }}
- 📝 Update generated documentation
## Automated Changes
This PR was automatically created by the weekly version check workflow.
---
**Release Notes**: https://github.com/sourcebot-dev/sourcebot/releases/tag/${{ steps.latest-version.outputs.latest }}
branch: update-sourcebot-${{ steps.latest-version.outputs.latest }}
delete-branch: true
reviewers: |
brendan-kellam
msukkari
labels: |
automated
dependencies
sourcebot-update