Skip to content

Commit

Permalink
chore: set up release for argus-config (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
hspitzley-czi authored Jul 19, 2024
1 parent 35b3a5c commit 20ecbd5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 32 deletions.
59 changes: 27 additions & 32 deletions .github/workflows/chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,39 @@ 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: |
core.setOutput("released", context.ref.includes('refs/tags/stack'))
core.setOutput("tag", context.ref.split("/").pop())
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.existSync(path.join(releaseName, 'Chart.yaml')));
core.setOutput("release_name", releaseName);
} else {
core.setOutput("released", false);
}
outputs:
chart_released: ${{ steps.chart_released.outputs.released }}
tag: ${{ steps.chart_released.outputs.tag }}
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 Version
id: parse_version
- name: Parse Tag
id: parse_tag
uses: actions/github-script@v7
with:
result-encoding: string
script: return context.ref.replace('refs/tags/stack-v', '')
script: return context.ref.replace('refs/tags/', '')
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
Expand All @@ -44,32 +55,21 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
path: chart-repo
ref: artifacts
repository: chanzuckerberg/argo-helm-charts
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
# 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 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}/chart-repo/stack"
RELEASE=${{ needs.check-chart-released.outputs.tag }}
VERSION=${{ steps.parse_version.outputs.result }}
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"
Expand All @@ -80,21 +80,16 @@ jobs:
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
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 }} ${VERSION}"
git commit -m "chore: publish charts from ${{ github.repository }} ${{ steps.parse_tag.outputs.result }}"
git push
env:
GH_CRED: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions argus-config/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ global:

ingress:
host: "foo.example.co"

0 comments on commit 20ecbd5

Please sign in to comment.