Release Chart #17
Workflow file for this run
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: Release Chart | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'New version (e.g. 1.2.3). If omitted, bumps based on changelog.' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.CORTEX_HELM_CHART_CI_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.12.1 | |
| - name: Bump Version | |
| run: make bump-version VERSION="${{ inputs.version }}" | |
| - name: Get New Version | |
| id: version | |
| run: | | |
| new_version=$(grep '^version:' Chart.yaml | awk '{print $2}') | |
| echo "new_version=$new_version" >> $GITHUB_OUTPUT | |
| - name: Update README | |
| run: make README.md | |
| - name: Package Chart | |
| run: | | |
| helm repo add bitnami https://charts.bitnami.com/bitnami | |
| helm dependency build | |
| helm package . -d docs | |
| helm repo index ./docs/ --url https://cortexproject.github.io/cortex-helm-chart | |
| - name: Create or Update Pull Request | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.CORTEX_HELM_CHART_CI_TOKEN }} | |
| run: | | |
| git checkout -b release-${{ steps.version.outputs.new_version }} | |
| git add Chart.yaml README.md CHANGELOG.md docs/ | |
| git commit -s -m "Release ${{ steps.version.outputs.new_version }}" | |
| git push --force origin release-${{ steps.version.outputs.new_version }} | |
| # Check if a PR already exists for this head branch | |
| existing_pr=$(gh pr list --head release-${{ steps.version.outputs.new_version }} --json number --jq '.[0].number') | |
| if [ -n "$existing_pr" ]; then | |
| echo "PR #$existing_pr already exists — updating title/body" | |
| gh pr edit "$existing_pr" \ | |
| --title "Release ${{ steps.version.outputs.new_version }}" \ | |
| --body "Automated release PR for version ${{ steps.version.outputs.new_version }}" | |
| else | |
| gh pr create \ | |
| --title "Release ${{ steps.version.outputs.new_version }}" \ | |
| --body "Automated release PR for version ${{ steps.version.outputs.new_version }}" \ | |
| --base ${{ github.ref_name }} \ | |
| --head release-${{ steps.version.outputs.new_version }} | |
| fi |