-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
push helm chart as oci image to ghcr on release (tag) Signed-off-by: adrianc <[email protected]>
- Loading branch information
1 parent
e6ad1e1
commit 3a347b4
Showing
4 changed files
with
236 additions
and
123 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "Push helm chart on release" | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
package-and-push-helm-chart: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: update chart | ||
env: | ||
GITHUB_TAG: ${{ github.ref_name }} | ||
GITHUB_REPO_OWNER: ${{ github.repository_owner }} | ||
run: make chart-prepare-release | ||
|
||
- name: push chart | ||
env: | ||
GITHUB_TAG: ${{ github.ref_name }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REPO_OWNER: ${{ github.repository_owner }} | ||
run: make chart-push-release |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# github repo owner: e.g mellanox | ||
GITHUB_REPO_OWNER=${GITHUB_REPO_OWNER:-} | ||
# github api token with package:write permissions | ||
GITHUB_TOKEN=${GITHUB_TOKEN:-} | ||
# github tag e.g v1.2.3 | ||
GITHUB_TAG=${GITHUB_TAG:-} | ||
|
||
BASE=${PWD} | ||
HELM_CMD="${BASE}/bin/helm" | ||
HELM_CHART=${BASE}/deployment/maintenance-operator-chart | ||
HELM_CHART_VERSION=${GITHUB_TAG#"v"} | ||
HELM_CHART_TARBALL="maintenance-operator-chart-${HELM_CHART_VERSION}.tgz" | ||
|
||
if [ -z "$GITHUB_REPO_OWNER" ]; then | ||
echo "ERROR: GITHUB_REPO_OWNER must be provided as env var" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GITHUB_TOKEN" ]; then | ||
echo "ERROR: GITHUB_TOKEN must be provided as env var" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GITHUB_TAG" ]; then | ||
echo "ERROR: GITHUB_TAG must be provided as env var" | ||
exit 1 | ||
fi | ||
|
||
$HELM_CMD package ${HELM_CHART} | ||
$HELM_CMD registry login ghcr.io -u ${GITHUB_REPO_OWNER} -p ${GITHUB_TOKEN} | ||
$HELM_CMD push ${HELM_CHART_TARBALL} oci://ghcr.io/${GITHUB_REPO_OWNER} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
# github tag e.g v1.2.3 | ||
GITHUB_TAG=${GITHUB_TAG:-} | ||
# github repo owner e.g mellanox | ||
GITHUB_REPO_OWNER=${GITHUB_REPO_OWNER:-} | ||
|
||
BASE=${PWD} | ||
YQ_CMD="${BASE}/bin/yq" | ||
HELM_VALUES=${BASE}/deployment/maintenance-operator-chart/values.yaml | ||
HELM_CHART=${BASE}/deployment/maintenance-operator-chart/Chart.yaml | ||
|
||
|
||
if [ -z "$GITHUB_TAG" ]; then | ||
echo "ERROR: GITHUB_TAG must be provided as env var" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$GITHUB_REPO_OWNER" ]; then | ||
echo "ERROR: GITHUB_REPO_OWNER must be provided as env var" | ||
exit 1 | ||
fi | ||
|
||
# tag provided via env var | ||
OPERATOR_TAG=${GITHUB_TAG} | ||
|
||
# patch values.yaml in-place | ||
|
||
# maintenance-operator image: | ||
OPERATOR_REPO=${GITHUB_REPO_OWNER} # this is used to allow to release maintenance-operator from forks | ||
$YQ_CMD -i ".operator.image.repository = \"ghcr.io/${OPERATOR_REPO}/maintenance-operator\"" ${HELM_VALUES} | ||
|
||
# patch Chart.yaml in-place | ||
$YQ_CMD -i ".version = \"${OPERATOR_TAG#"v"}\"" ${HELM_CHART} | ||
$YQ_CMD -i ".appVersion = \"${OPERATOR_TAG}\"" ${HELM_CHART} |