From f8050ca69e033a73f26a50693613834671dd4a39 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 30 Mar 2025 20:31:39 -0500 Subject: [PATCH] configure CI to push Helm charts --- .gitea/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 31b5e9c..fb60992 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -19,6 +19,12 @@ jobs: checks: write contents: write steps: + - name: Login to Docker + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Checkout uses: actions/checkout@v4 @@ -57,12 +63,26 @@ jobs: env: DOCKER_ORG: ryanc DOCKER_LATEST: latest + defaults: + run: + shell: bash steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # all history for all branches and tags + - name: Prepare + id: prep + run: | + VERSION="sha-${GITHUB_SHA::8}" + if [[ "$GITHUB_REF" == refs/tags/* ]]; then + VERSION="${GITHUB_REF/refs\/tags\//}" + fi + printf "GITHUB_REF=%s\n" "$GITHUB_REF" + printf "GITHUB_SHA=%s\n" "$GITHUB_SHA" + printf "VERSION=%s\n" "$VERSION" | tee -a "$GITHUB_OUTPUT" + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -94,3 +114,14 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + - name: Setup Helm + uses: azure/setup-helm@v4.3.0 + + - name: Publish Helm chart + if: ${{ contains(github.ref, 'refs/tags/') }} + run: | + HELM_VERSION="${{ steps.prep.outputs.VERSION }}" + HELM_VERSION="${HELM_VERSION#v}" + helm package charts/kubernaut + helm push "kubernaut-${HELM_VERSION}.tgz" oci://git.kill0.net/ryanc/helm-charts