Add per service docs #53
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: Build and Publish Helm Charts to GHCR | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
packages: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.3 | |
- name: Log in to GitHub Container Registry | |
if: github.event_name == 'push' | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin | |
- name: Build Helm Charts | |
run: | | |
mkdir "$GITHUB_WORKSPACE/build" | |
for chart in $(find ./charts -mindepth 2 -maxdepth 2 -type d); do | |
VERSION=$(awk '/^version:/ {print $2}' "$chart/Chart.yaml") | |
NAME=$(awk '/^name:/ {print $2}' "$chart/Chart.yaml") | |
if [ "${GITHUB_REF_NAME}" != "${{ github.event.repository.default_branch }}" ]; then | |
VERSION="$VERSION-${GITHUB_REF_NAME//\//-}" | |
fi | |
helm dependency update "$chart" | |
helm package "$chart" --version "$VERSION" | |
mv "$NAME-$VERSION.tgz" "$GITHUB_WORKSPACE/build/" | |
done | |
- name: Push Helm Charts | |
if: github.event_name == 'push' | |
run: | | |
GHCR_PATH="$(echo "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/charts" | tr '[:upper:]' '[:lower:]')" | |
for PACKAGE_FILE in "$GITHUB_WORKSPACE"/build/*.tgz; do | |
echo "Pushing $PACKAGE_FILE to oci://$GHCR_PATH" | |
helm push "$PACKAGE_FILE" "oci://$GHCR_PATH" | |
done |