Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
21 changes: 21 additions & 0 deletions .github/workflows/update-sourcebot-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ jobs:

echo "chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT

- name: Update CHANGELOG.md
if: steps.version-check.outputs.needs_update == 'true'
run: |
LATEST_VERSION=${{ steps.latest-version.outputs.latest }}
CHART_VERSION=${{ steps.update-chart.outputs.chart_version }}
DATE=$(date +%Y-%m-%d)

# Add the bump entry under [Unreleased]
sed -i "/## \[Unreleased\]/a\\
\\
### Changed\\
- Bumped Sourcebot to $LATEST_VERSION. [Release notes](https://github.com/sourcebot-dev/sourcebot/releases/tag/$LATEST_VERSION)" CHANGELOG.md

# Finalize [Unreleased] into a dated version header
sed -i "/## \[Unreleased\]/a\\
\\
## [$CHART_VERSION] - $DATE" CHANGELOG.md

echo "Updated CHANGELOG.md"
cat CHANGELOG.md | head -n 20

- name: Install helm-docs
if: steps.version-check.outputs.needs_update == 'true'
run: |
Expand Down
Loading