v0.3.1 #8
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 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 0.2.0)' | |
| required: true | |
| type: string | |
| dry_run: | |
| description: 'Dry run (build but do not push)' | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-and-push-image: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get release version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION="${{ github.event.release.tag_name }}" | |
| fi | |
| VERSION="${VERSION#v}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Version: ${VERSION}" | |
| - name: Set image name (lowercase) | |
| id: image | |
| run: | | |
| IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
| echo "name=${IMAGE_NAME}" >> $GITHUB_OUTPUT | |
| echo "Image: ${IMAGE_NAME}" | |
| - name: Check dry run | |
| id: config | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.dry_run }}" = "true" ]; then | |
| echo "push=false" >> $GITHUB_OUTPUT | |
| echo "DRY RUN: Will build but NOT push" | |
| else | |
| echo "push=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ steps.config.outputs.push }} | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ steps.version.outputs.version }} | |
| ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:latest | |
| publish-helm-chart: | |
| name: Publish Helm Chart | |
| runs-on: ubuntu-latest | |
| needs: build-and-push-image | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.14.0 | |
| - name: Set registry names (lowercase) | |
| id: registry | |
| run: | | |
| OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
| echo "owner=${OWNER}" >> $GITHUB_OUTPUT | |
| echo "repo=${REPO}" >> $GITHUB_OUTPUT | |
| - name: Check dry run | |
| id: config | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.dry_run }}" = "true" ]; then | |
| echo "push=false" >> $GITHUB_OUTPUT | |
| echo "DRY RUN: Will package but NOT push" | |
| else | |
| echo "push=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Log in to Helm Registry | |
| if: steps.config.outputs.push == 'true' | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin | |
| - name: Get release version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION="${{ github.event.release.tag_name }}" | |
| fi | |
| VERSION="${VERSION#v}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Version: ${VERSION}" | |
| - name: Update Chart.yaml version | |
| run: | | |
| sed -i "s/^version:.*/version: ${{ steps.version.outputs.version }}/" charts/scaler/Chart.yaml | |
| sed -i "s/^appVersion:.*/appVersion: \"${{ steps.version.outputs.version }}\"/" charts/scaler/Chart.yaml | |
| echo "=== Updated Chart.yaml ===" | |
| cat charts/scaler/Chart.yaml | |
| - name: Update image repository and tag in values.yaml | |
| run: | | |
| sed -i "s|repository:.*|repository: ${{ env.REGISTRY }}/${{ steps.registry.outputs.repo }}|" charts/scaler/values.yaml | |
| sed -i "s/tag:.*/tag: \"${{ steps.version.outputs.version }}\"/" charts/scaler/values.yaml | |
| echo "=== Updated values.yaml ===" | |
| head -15 charts/scaler/values.yaml | |
| - name: Sync CRDs to Helm chart | |
| run: | | |
| cp config/crd/scaler.bud.studio_budaiscalers.yaml charts/scaler/crds/ | |
| - name: Lint Helm chart | |
| run: helm lint charts/scaler | |
| - name: Package Helm chart | |
| run: | | |
| helm package charts/scaler | |
| ls -la *.tgz | |
| - name: Push Helm chart to GHCR | |
| if: steps.config.outputs.push == 'true' | |
| run: | | |
| helm push scaler-${{ steps.version.outputs.version }}.tgz oci://${{ env.REGISTRY }}/${{ steps.registry.outputs.owner }}/charts | |
| - name: Upload Helm chart to release | |
| if: steps.config.outputs.push == 'true' && github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: scaler-${{ steps.version.outputs.version }}.tgz | |
| update-release-notes: | |
| name: Update Release Notes | |
| runs-on: ubuntu-latest | |
| needs: [build-and-push-image, publish-helm-chart] | |
| if: github.event_name == 'release' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Set registry names (lowercase) | |
| id: registry | |
| run: | | |
| OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
| echo "owner=${OWNER}" >> $GITHUB_OUTPUT | |
| echo "repo=${REPO}" >> $GITHUB_OUTPUT | |
| - name: Get release version | |
| id: version | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| VERSION="${VERSION#v}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Update release body with installation instructions | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| append_body: true | |
| body: | | |
| --- | |
| ## Installation | |
| ### Using Helm (OCI Registry) | |
| ```bash | |
| helm install scaler oci://ghcr.io/${{ steps.registry.outputs.owner }}/charts/scaler \ | |
| --version ${{ steps.version.outputs.version }} \ | |
| --namespace scaler-system \ | |
| --create-namespace | |
| ``` | |
| ### Using Docker Image | |
| ```bash | |
| docker pull ghcr.io/${{ steps.registry.outputs.repo }}:${{ steps.version.outputs.version }} | |
| ``` |