Skip to content

Commit

Permalink
Merge branch 'ci/update-helm-chart-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
vdice committed Nov 20, 2024
2 parents 68e9ba3 + 7cc7cda commit 2f22070
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ jobs:
- name: Lint packaged chart
run: make helm-lint

- name: Upload chart and manifests as GitHub artifact
- name: Upload chart as GitHub artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.CHART_NAME }}
path: _dist
path: _dist/${{ env.CHART_NAME }}-${{ env.CHART_VERSION }}.tgz

- name: Publish chart
env:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ jobs:
path: ./
merge-multiple: true

- name: Download helm chart artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: runtime-class-manager
path: ./

- name: Display structure of downloaded files
run: ls -R

Expand All @@ -106,6 +112,11 @@ jobs:
let fs = require('fs');
let path = require('path');
const { RELEASE_ID, TAG_NAME } = process.env
# The chart version omits the leading 'v' to adhere to Helm's versioning requirements
let chartVersion = `${TAG_NAME}`.replace("v", "")
let files = [
'runtime-class-manager-sbom-amd64.spdx',
'runtime-class-manager-sbom-amd64.spdx.cert',
Expand All @@ -125,8 +136,8 @@ jobs:
'shim-downloader-sbom-arm64.spdx',
'shim-downloader-sbom-arm64.spdx.cert',
'shim-downloader-sbom-arm64.spdx.sig',
`runtime-class-manager-${chartVersion}.tgz`
]
const {RELEASE_ID} = process.env
for (const file of files) {
let file_data = fs.readFileSync(file);
Expand Down
4 changes: 2 additions & 2 deletions deploy/update-chart-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if [[ "${APP_VERSION}" =~ ^v[0-9]+.[0-9]+.[0-9]+(.*)? ]]; then
fi

## Update Chart.yaml with CHART_VERSION and APP_VERSION
sed -r -i.bak -e "s%^version: .*%version: ${CHART_VERSION}%g" "${STAGING_DIR}/${CHART_NAME}-${CHART_VERSION}/Chart.yaml"
sed -r -i.bak -e "s%^appVersion: .*%appVersion: ${APP_VERSION}%g" "${STAGING_DIR}/${CHART_NAME}-${CHART_VERSION}/Chart.yaml"
yq -i '.version = env(CHART_VERSION)' "${STAGING_DIR}/${CHART_NAME}-${CHART_VERSION}/Chart.yaml"
yq -i '.appVersion = env(APP_VERSION)' "${STAGING_DIR}/${CHART_NAME}-${CHART_VERSION}/Chart.yaml"

## Update values.yaml tags
yq -i '.image.tag = env(APP_VERSION)' "${STAGING_DIR}/${CHART_NAME}-${CHART_VERSION}/values.yaml"
Expand Down

0 comments on commit 2f22070

Please sign in to comment.