Skip to content

argus-config: v1.2.2 #58

argus-config: v1.2.2

argus-config: v1.2.2 #58

Workflow file for this run

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: Branch
id: branch
uses: actions/github-script@v7
with:
result-encoding: string
script: return 'artifacts'
- 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: ${{ steps.branch.outputs.result }}
token: ${{ steps.generate_token.outputs.token }}
- uses: azure/setup-helm@v4
with:
version: '3.15.2'
- name: Publish charts
run: |
set -ue
set -o pipefail
# the location of the chart package
CHARTS_DIR="${{ needs.check-chart-released.outputs.release_name }}"
# location of release to download the chart from
CHART_DOWNLOAD_URL="https://github.com/${{ github.repository }}/raw/${{ steps.branch.outputs.result }}"
git config --global user.email "[email protected]"
git config --global user.name "CZI Argus Helm Publisher Bot"
PACKAGE_DIR="."
echo ------
cat ${PACKAGE_DIR}/index.yaml
echo ------
git pull
git merge origin/main
echo ------
cat ${CHARTS_DIR}/Chart.yaml
echo ------
helm dependency update ${{ needs.check-chart-released.outputs.release_name }}
helm package ${CHARTS_DIR} -d ${PACKAGE_DIR}
helm repo index ${PACKAGE_DIR} --url ${CHART_DOWNLOAD_URL} --merge ${PACKAGE_DIR}/index.yaml
git add -A
git commit -m "chore: publish charts from ${{ github.repository }} ${{ steps.parse_tag.outputs.result }}"
git push