Skip to content

Commit 6bcf240

Browse files
Merge pull request #2 from sourcebot-dev/bkellam/release_workflow
Add auto version updating workflow
2 parents 552eba8 + b887a99 commit 6bcf240

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Update Sourcebot Version
2+
on:
3+
schedule:
4+
- cron: '0 9 * * 1' # Run every Monday at 9 AM UTC
5+
workflow_dispatch: # Allow manual triggering
6+
7+
jobs:
8+
check-and-update:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Get current Sourcebot version
21+
id: current-version
22+
run: |
23+
CURRENT_VERSION=$(grep 'appVersion:' charts/sourcebot/Chart.yaml | cut -d ' ' -f 2 | tr -d '"')
24+
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
25+
echo "Current Sourcebot version: $CURRENT_VERSION"
26+
27+
- name: Get latest Sourcebot release
28+
id: latest-version
29+
run: |
30+
LATEST_VERSION=$(curl -s https://api.github.com/repos/sourcebot-dev/sourcebot/releases/latest | jq -r '.tag_name')
31+
echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT
32+
echo "Latest Sourcebot version: $LATEST_VERSION"
33+
34+
- name: Compare versions
35+
id: version-check
36+
run: |
37+
if [ "${{ steps.current-version.outputs.current }}" != "${{ steps.latest-version.outputs.latest }}" ]; then
38+
echo "needs_update=true" >> $GITHUB_OUTPUT
39+
echo "New version available: ${{ steps.latest-version.outputs.latest }}"
40+
else
41+
echo "needs_update=false" >> $GITHUB_OUTPUT
42+
echo "Already up to date"
43+
fi
44+
45+
- name: Setup Node.js
46+
if: steps.version-check.outputs.needs_update == 'true'
47+
uses: actions/setup-node@v4
48+
with:
49+
node-version: '22'
50+
51+
- name: Install semver
52+
if: steps.version-check.outputs.needs_update == 'true'
53+
run: npm install -g semver
54+
55+
- name: Update Chart.yaml
56+
if: steps.version-check.outputs.needs_update == 'true'
57+
id: update-chart
58+
run: |
59+
# Get current chart version
60+
CURRENT_CHART_VERSION=$(grep '^version:' charts/sourcebot/Chart.yaml | cut -d ' ' -f 2)
61+
echo "Current chart version: $CURRENT_CHART_VERSION"
62+
63+
# Increment patch version
64+
NEW_CHART_VERSION=$(semver -i patch $CURRENT_CHART_VERSION)
65+
echo "New chart version: $NEW_CHART_VERSION"
66+
67+
# Update Chart.yaml
68+
sed -i "s/^version: .*/version: $NEW_CHART_VERSION/" charts/sourcebot/Chart.yaml
69+
sed -i "s/^appVersion: .*/appVersion: ${{ steps.latest-version.outputs.latest }}/" charts/sourcebot/Chart.yaml
70+
71+
echo "chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT
72+
73+
- name: Install helm-docs
74+
if: steps.version-check.outputs.needs_update == 'true'
75+
run: |
76+
cd /tmp
77+
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
78+
sudo mv helm-docs /usr/local/bin/
79+
80+
- name: Update README.md
81+
if: steps.version-check.outputs.needs_update == 'true'
82+
run: |
83+
cd charts/sourcebot
84+
helm-docs
85+
86+
- name: Create Pull Request
87+
if: steps.version-check.outputs.needs_update == 'true'
88+
uses: peter-evans/create-pull-request@v6
89+
with:
90+
token: ${{ secrets.GITHUB_TOKEN }}
91+
commit-message: |
92+
chore: bump sourcebot to ${{ steps.latest-version.outputs.latest }}
93+
94+
- Update appVersion to ${{ steps.latest-version.outputs.latest }}
95+
- Bump chart version to ${{ steps.update-chart.outputs.chart_version }}
96+
- Update generated documentation
97+
title: "chore: bump sourcebot to ${{ steps.latest-version.outputs.latest }}"
98+
body: |
99+
## Summary
100+
This PR updates Sourcebot to version ${{ steps.latest-version.outputs.latest }}.
101+
102+
## Changes
103+
- ⬆️ Update appVersion from ${{ steps.current-version.outputs.current }} to ${{ steps.latest-version.outputs.latest }}
104+
- 📦 Bump chart version to ${{ steps.update-chart.outputs.chart_version }}
105+
- 📝 Update generated documentation
106+
107+
## Automated Changes
108+
This PR was automatically created by the weekly version check workflow.
109+
110+
---
111+
**Release Notes**: https://github.com/sourcebot-dev/sourcebot/releases/tag/${{ steps.latest-version.outputs.latest }}
112+
branch: update-sourcebot-${{ steps.latest-version.outputs.latest }}
113+
delete-branch: true
114+
labels: |
115+
automated
116+
dependencies
117+
sourcebot-update
118+

0 commit comments

Comments
 (0)