Create Release PR #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |