Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ on:
- v*

jobs:
helm-oci:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: azure/setup-helm@v4.3.0
- name: Push artifacts
run: PUSH=true hack/push-artifacts.sh ghcr.io/stackitcloud/yawol/yawol-controller
build:
runs-on: ubuntu-latest
permissions:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
artifacts

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
38 changes: 38 additions & 0 deletions hack/push-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

chart_name=yawol-controller
helm_artifacts=artifacts/charts
rm -rf "$helm_artifacts"
mkdir -p "$helm_artifacts"

function image_registry() {
echo "$1" | cut -d '/' -f -2
}

function image_repo() {
echo "$1" | cut -d ':' -f 1
}

function image_tag() {
git describe --tag --always --dirty
}

## HELM
cp -r charts/${chart_name} "$helm_artifacts"
yq -i "\
( .image.repository = \"$(image_repo "$1")\" ) | \
( .image.tag = \"$(image_tag "$1")\" )\
" "$helm_artifacts/${chart_name}/values.yaml"

# push to registry
if [ "${PUSH:=}" != "true" ] ; then
echo "Skip pushing artifacts because PUSH is not set to 'true'"
exit 0
fi

helm package "$helm_artifacts/${chart_name}" --version "$(image_tag "$1")" -d "$helm_artifacts" > /dev/null 2>&1
helm push "$helm_artifacts/${chart_name}-"* "oci://$(image_registry "$1")/charts"