stack: v1.1.2 #3
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: Check Release | |
id: chart_released | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
core.setOutput("released", context.ref.includes('refs/tags/stack')) | |
core.setOutput("tag", context.ref.split("/").pop()) | |
outputs: | |
chart_released: ${{ steps.chart_released.outputs.released }} | |
tag: ${{ steps.chart_released.outputs.tag }} | |
release: | |
if: ${{ needs.check-chart-released.outputs.chart_released == 'true' }} | |
needs: | |
- check-chart-released | |
runs-on: [ARM64, self-hosted, Linux] | |
steps: | |
- name: Parse Version | |
id: parse_version | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: return context.ref.replace('refs/tags/stack-v', '') | |
- 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 | |
path: chart-repo | |
ref: artifacts | |
repository: chanzuckerberg/argo-helm-charts | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: Publish charts | |
run: | | |
set -ue | |
set -o pipefail | |
# install helm | |
RELEASE_URL=https://get.helm.sh/helm-v3.15.2-linux-arm64.tar.gz | |
DIR_NAME=helm | |
OUT_DIR="/tmp/${DIR_NAME}" | |
mkdir -p ${OUT_DIR} | |
OUT_FILE="${OUT_DIR}/helm.tar.gz" | |
curl -sSL ${RELEASE_URL} -o ${OUT_FILE} | |
tar -zxf ${OUT_FILE} -C ${OUT_DIR} | |
HELM_CMD=$(find ${OUT_DIR} -type f -name "helm") | |
chmod +x ${HELM_CMD} | |
# the index.yaml file will be hosted by the happy github pages site | |
INDEX_DIR="${GITHUB_WORKSPACE}/chart-repo" | |
# the location of the chart package | |
CHARTS_DIR="${GITHUB_WORKSPACE}/chart-repo/stack" | |
RELEASE=${{ needs.check-chart-released.outputs.tag }} | |
VERSION=${{ steps.parse_version.outputs.result }} | |
# location of release to download the chart from | |
CHART_DOWNLOAD_URL="https://github.com/chanzuckerberg/${{ github.repository }}/raw/artifacts/stack-${VERSION}.tgz" | |
git config --global user.email "[email protected]" | |
git config --global user.name "CZI Argus Helm Publisher Bot" | |
echo ------ | |
cat ${INDEX_DIR}/index.yaml | |
echo ------ | |
cd chart-repo | |
git pull | |
git merge origin/main | |
sed -i "s/appVersion\:\s[0-9.]\+/appVersion\: ${VERSION}/g" ${CHARTS_DIR}/Chart.yaml | |
sed -i "s/version\:\s[0-9.]\+/version\: ${VERSION}/g" ${CHARTS_DIR}/Chart.yaml | |
echo ------ | |
cat ${CHARTS_DIR}/Chart.yaml | |
echo ------ | |
PACKAGE_DIR="." | |
${HELM_CMD} package ${CHARTS_DIR} -d ${PACKAGE_DIR} --version ${VERSION} | |
${HELM_CMD} 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 }} ${VERSION}" | |
git push | |
env: | |
GH_CRED: ${{ secrets.GITHUB_TOKEN }} |