|
| 1 | +name: Helm release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Kestra version to release (e.g. 0.21.1, without v prefix)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + dry_run: |
| 11 | + description: 'Dry run — package charts but do not upload to GCS' |
| 12 | + required: true |
| 13 | + type: boolean |
| 14 | + default: true |
| 15 | + workflow_call: |
| 16 | + inputs: |
| 17 | + dry_run: |
| 18 | + description: 'Dry run — package charts but do not upload to GCS' |
| 19 | + required: false |
| 20 | + type: boolean |
| 21 | + default: false |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read |
| 25 | + id-token: write |
| 26 | + |
| 27 | +jobs: |
| 28 | + helm-release: |
| 29 | + name: Package and publish Helm charts |
| 30 | + runs-on: ubuntu-latest |
| 31 | + env: |
| 32 | + BUCKET: helm-charts-kestra-host |
| 33 | + REPO_URL: https://helm.kestra.io/ |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v5 |
| 38 | + |
| 39 | + - name: Resolve version and dry-run flag |
| 40 | + id: config |
| 41 | + run: | |
| 42 | + if [[ -n "${{ inputs.version }}" ]]; then |
| 43 | + VERSION="${{ inputs.version }}" |
| 44 | + TAG="v${VERSION}" |
| 45 | + else |
| 46 | + TAG="${GITHUB_REF_NAME}" |
| 47 | + VERSION="${TAG#v}" |
| 48 | + fi |
| 49 | + DRY_RUN="${{ inputs.dry_run }}" |
| 50 | + echo "tag=${TAG}" >> $GITHUB_OUTPUT |
| 51 | + echo "version=${VERSION}" >> $GITHUB_OUTPUT |
| 52 | + echo "dry_run=${DRY_RUN}" >> $GITHUB_OUTPUT |
| 53 | + echo "Version: ${VERSION} | Tag: ${TAG} | Dry run: ${DRY_RUN}" |
| 54 | +
|
| 55 | + - name: Update Chart.yaml versions |
| 56 | + env: |
| 57 | + VERSION: ${{ steps.config.outputs.version }} |
| 58 | + TAG: ${{ steps.config.outputs.tag }} |
| 59 | + run: | |
| 60 | + set -euo pipefail |
| 61 | + for chart in charts/kestra charts/kestra-starter; do |
| 62 | + sed -i "s/^version:.*/version: \"${VERSION}\"/" ${chart}/Chart.yaml |
| 63 | + sed -i "s/^appVersion:.*/appVersion: \"${TAG}\"/" ${chart}/Chart.yaml |
| 64 | + done |
| 65 | + # Update kestra dep version in kestra-starter |
| 66 | + awk -v ver="${VERSION}" ' |
| 67 | + /- name: kestra/ { found=1 } |
| 68 | + found && /version:/ { sub(/version:.*/, "version: \"" ver "\""); found=0 } |
| 69 | + { print } |
| 70 | + ' charts/kestra-starter/Chart.yaml > /tmp/chart-starter.yaml |
| 71 | + mv /tmp/chart-starter.yaml charts/kestra-starter/Chart.yaml |
| 72 | +
|
| 73 | + - name: Lint kestra chart |
| 74 | + run: | |
| 75 | + helm lint charts/kestra \ |
| 76 | + --set "configurations.application=kestra.variable.globals.foo: bar" |
| 77 | +
|
| 78 | + - name: Package kestra chart |
| 79 | + run: | |
| 80 | + mkdir -p release/ |
| 81 | + helm package charts/kestra -d release/ |
| 82 | +
|
| 83 | + - name: Bundle kestra as kestra-starter dependency |
| 84 | + env: |
| 85 | + VERSION: ${{ steps.config.outputs.version }} |
| 86 | + run: | |
| 87 | + # Place freshly packaged kestra tgz as bundled dep so helm package |
| 88 | + # does not need network access to resolve the kestra dependency. |
| 89 | + mkdir -p charts/kestra-starter/charts/ |
| 90 | + cp release/kestra-${VERSION}.tgz charts/kestra-starter/charts/ |
| 91 | + # Remove stale Chart.lock — version bump makes it invalid |
| 92 | + rm -f charts/kestra-starter/Chart.lock |
| 93 | +
|
| 94 | + - name: Lint kestra-starter chart |
| 95 | + run: helm lint charts/kestra-starter |
| 96 | + |
| 97 | + - name: Package kestra-starter chart |
| 98 | + run: helm package charts/kestra-starter -d release/ |
| 99 | + |
| 100 | + - name: Verify packaged charts render |
| 101 | + env: |
| 102 | + VERSION: ${{ steps.config.outputs.version }} |
| 103 | + run: | |
| 104 | + helm template test release/kestra-${VERSION}.tgz \ |
| 105 | + --set "configurations.application=kestra.variable.globals.foo: bar" > /dev/null |
| 106 | + echo "kestra-${VERSION}.tgz renders OK" |
| 107 | + helm template test release/kestra-starter-${VERSION}.tgz > /dev/null |
| 108 | + echo "kestra-starter-${VERSION}.tgz renders OK" |
| 109 | +
|
| 110 | + - name: Show packaged charts |
| 111 | + run: ls -lh release/*.tgz |
| 112 | + |
| 113 | + - name: Authenticate to GCP |
| 114 | + uses: google-github-actions/auth@v2 |
| 115 | + with: |
| 116 | + workload_identity_provider: projects/230725787862/locations/global/workloadIdentityPools/github/providers/github |
| 117 | + service_account: helm-charts-publisher@kestra-host.iam.gserviceaccount.com |
| 118 | + |
| 119 | + - uses: google-github-actions/setup-gcloud@v2 |
| 120 | + |
| 121 | + - name: Download existing index.yaml from GCS |
| 122 | + run: gsutil cp gs://${BUCKET}/index.yaml existing-index.yaml |
| 123 | + |
| 124 | + - name: Generate merged index.yaml |
| 125 | + run: | |
| 126 | + helm repo index release/ --merge existing-index.yaml --url ${REPO_URL} |
| 127 | + echo "=== Preview (first 30 lines) ===" |
| 128 | + head -30 release/index.yaml |
| 129 | +
|
| 130 | + - name: Dry run — show what would be uploaded |
| 131 | + if: ${{ steps.config.outputs.dry_run == 'true' }} |
| 132 | + run: | |
| 133 | + echo "DRY RUN — no upload performed." |
| 134 | + echo "" |
| 135 | + echo "Would upload to gs://${BUCKET}/:" |
| 136 | + ls -lh release/*.tgz release/index.yaml |
| 137 | +
|
| 138 | + - name: Upload to GCS |
| 139 | + if: ${{ steps.config.outputs.dry_run == 'false' }} |
| 140 | + run: | |
| 141 | + set -euo pipefail |
| 142 | + # Upload .tgz files first — index must never reference a missing artifact |
| 143 | + gsutil -m cp release/*.tgz gs://${BUCKET}/ |
| 144 | + gsutil cp release/index.yaml gs://${BUCKET}/index.yaml |
| 145 | + echo "Published:" |
| 146 | + ls -lh release/*.tgz |
0 commit comments