Package and Publish Helm Chart #12
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: Package and Publish Helm Chart | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_bump: | |
| description: 'Type of version bump to perform' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| packages: write | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - 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@v3 | |
| with: | |
| version: v3.12.0 | |
| - name: Bump Chart Version | |
| id: bump_version | |
| run: | | |
| # Get current version from Chart.yaml | |
| CURRENT_VERSION=$(grep 'version:' charts/benchmark-workers/Chart.yaml | awk '{print $2}') | |
| echo "Current version: $CURRENT_VERSION" | |
| # Split version into parts | |
| IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION" | |
| MAJOR=${VERSION_PARTS[0]} | |
| MINOR=${VERSION_PARTS[1]} | |
| PATCH=${VERSION_PARTS[2]} | |
| # Increment version based on input | |
| if [[ "${{ inputs.version_bump }}" == "major" ]]; then | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| elif [[ "${{ inputs.version_bump }}" == "minor" ]]; then | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| else | |
| PATCH=$((PATCH + 1)) | |
| fi | |
| NEW_VERSION="$MAJOR.$MINOR.$PATCH" | |
| echo "New version: $NEW_VERSION" | |
| # Update Chart.yaml with new version | |
| sed -i "s/version: $CURRENT_VERSION/version: $NEW_VERSION/g" charts/benchmark-workers/Chart.yaml | |
| # Set output variable for use in later steps | |
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| # Commit the change | |
| git add charts/benchmark-workers/Chart.yaml | |
| git commit -m "Bump chart version to $NEW_VERSION [skip ci]" | |
| git push | |
| - name: Login to GHCR | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package and Push Helm chart | |
| run: | | |
| # Use version from previous step | |
| VERSION=${{ steps.bump_version.outputs.version }} | |
| echo "Chart version: $VERSION" | |
| # Package the chart | |
| helm package charts/benchmark-workers | |
| # Push to GHCR | |
| helm push benchmark-workers-${VERSION}.tgz oci://ghcr.io/temporalio/charts | |
| echo "✅ Chart pushed successfully to oci://ghcr.io/temporalio/charts/benchmark-workers:${VERSION}" |