From 9f2c59d4a114fff75e2208e923590f8fe2397672 Mon Sep 17 00:00:00 2001 From: ChandonPierre Date: Mon, 12 Aug 2024 22:17:12 -0400 Subject: [PATCH] feat(ci): publish helm chart --- .github/workflows/publish-chart.yaml | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/publish-chart.yaml diff --git a/.github/workflows/publish-chart.yaml b/.github/workflows/publish-chart.yaml new file mode 100644 index 00000000000000..06416c2dcc9cd0 --- /dev/null +++ b/.github/workflows/publish-chart.yaml @@ -0,0 +1,48 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Charts: Publish to GHCR OCI" + +on: + workflow_dispatch: {} + pull_request: + branches: ["coreweave"] + types: ["opened", "synchronize", "reopened"] + paths: + - .github/workflows/publish-chart.yaml + - "**/*" + +jobs: + publish-charts: + name: Publish chart + permissions: + contents: write + packages: write + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set VERSION from VERSION.txt + id: set_version + run: echo "VERSION=$(cat VERSION.txt)" >> $GITHUB_ENV + + - name: Set HELM_VERSION + run: echo "HELM_VERSION=${{ env.VERSION }}-${{ github.sha::0:7 }}" >> $GITHUB_ENV + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Helm + uses: azure/setup-helm@v4 + + - name: Package & Push Helm Charts + shell: bash + run: | + helm package cmd/k8s-operator/deploy/chart --dependency-update --version ${{ env.HELM_VERSION }} --app-version ${{ env.HELM_VERSION }} + pkg=$(ls tailscale-operator-*.tgz) + helm push "${pkg}" oci://ghcr.io/${{ github.repository }}/chart