stack: v1.4.2 #13
Workflow file for this run
This file contains 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 Charts | |
on: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-chart-released: | |
runs-on: [ARM64, self-hosted, Linux] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check Release | |
id: chart_released | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
const result = /refs\/tags\/(.*)-v[0-9.]+/.exec(context.ref) | |
if (result && result.length >= 2) { | |
const releaseName = result[1]; | |
core.setOutput("released", fs.existsSync(path.join(releaseName, 'Chart.yaml'))); | |
core.setOutput("release_name", releaseName); | |
} else { | |
core.setOutput("released", false); | |
} | |
outputs: | |
chart_released: ${{ steps.chart_released.outputs.released }} | |
release_name: ${{ steps.chart_released.outputs.release_name }} | |
release: | |
if: ${{ needs.check-chart-released.outputs.chart_released == 'true' }} | |
needs: | |
- check-chart-released | |
runs-on: [ARM64, self-hosted, Linux] | |
steps: | |
- name: Parse Tag | |
id: parse_tag | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: return context.ref.replace('refs/tags/', '') | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ secrets.CZI_RELEASE_PLEASE_APP_ID }} | |
private_key: ${{ secrets.CZI_RELEASE_PLEASE_PK }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: artifacts | |
token: ${{ steps.generate_token.outputs.token }} | |
- uses: azure/setup-helm@v4 | |
with: | |
version: '3.15.2' | |
id: install | |
- name: Publish charts | |
run: | | |
set -ue | |
set -o pipefail | |
# the index.yaml file will be hosted by the github pages site | |
INDEX_DIR="${GITHUB_WORKSPACE}" | |
# the location of the chart package | |
CHARTS_DIR="${GITHUB_WORKSPACE}/${{ needs.check-chart-released.outputs.release_name }}" | |
# location of release to download the chart from | |
CHART_DOWNLOAD_URL="https://github.com/${{ github.repository }}/raw/artifacts" | |
git config --global user.email "[email protected]" | |
git config --global user.name "CZI Argus Helm Publisher Bot" | |
echo ------ | |
cat ${INDEX_DIR}/index.yaml | |
echo ------ | |
git pull | |
git merge origin/main | |
echo ------ | |
cat ${CHARTS_DIR}/Chart.yaml | |
echo ------ | |
PACKAGE_DIR="." | |
helm dependency update ${PACKAGE_DIR} | |
helm package ${CHARTS_DIR} -d ${PACKAGE_DIR} | |
helm repo index ${PACKAGE_DIR} --url ${CHART_DOWNLOAD_URL} --merge ${INDEX_DIR}/index.yaml | |
git add -A | |
git commit -m "chore: publish charts from ${{ github.repository }} ${{ steps.parse_tag.outputs.result }}" | |
git push |