From dc0709fcb1a3a4f9d80c938919e5eb2f75a98811 Mon Sep 17 00:00:00 2001 From: Stanislaw Malinowski Date: Fri, 11 Oct 2024 10:39:09 +0000 Subject: [PATCH] try out by adding the needs field --- .github/workflows/_container.yml | 39 ++++++++++++++++++++++++++++- .github/workflows/helm.yml | 42 -------------------------------- 2 files changed, 38 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/helm.yml diff --git a/.github/workflows/_container.yml b/.github/workflows/_container.yml index 4857ee9e6..684cbcf0a 100644 --- a/.github/workflows/_container.yml +++ b/.github/workflows/_container.yml @@ -1,8 +1,13 @@ +name: Build and publish container on: workflow_call: +env: + GCR_IMAGE: ghcr.io/diamondlightsource/blueapi + HELM_VERSION: 3.10.3 + jobs: - build: + build_container: runs-on: ubuntu-latest steps: @@ -54,3 +59,35 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + helm_publish: + name: publish gcr + runs-on: ubuntu-latest + environment: prod + needs: build_container + steps: + - name: checkout repo + uses: actions/checkout@v3 + + - name: install helm + uses: Azure/setup-helm@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: install + + - name: login to acr using helm + run: | + echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.GCR_IMAGE }} --username ${{ github.repository_owner }} --password-stdin + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=tag + - name: package chart and push it + run: | + sed -i "$ a appVersion: ${GITHUB_REF##*/}" helm/blueapi/Chart.yaml + helm dependencies update helm/blueapi + helm package helm/blueapi --version ${GITHUB_REF##*/} -d /tmp/ + helm push /tmp/blueapi-${GITHUB_REF##*/}.tgz oci://ghcr.io/diamondlightsource/charts diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml deleted file mode 100644 index 8c23d1550..000000000 --- a/.github/workflows/helm.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Helm CI - -on: - push: - tags: - - "*" - -env: - GCR_IMAGE: ghcr.io/diamondlightsource/blueapi - HELM_VERSION: 3.10.3 - -jobs: - build: - name: publish gcr - runs-on: ubuntu-latest - environment: prod - steps: - - name: checkout repo - uses: actions/checkout@v3 - - - name: install helm - uses: Azure/setup-helm@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - id: install - - - name: login to acr using helm - run: | - echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ env.GCR_IMAGE }} --username ${{ github.repository_owner }} --password-stdin - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=tag - - name: package chart and push it - run: | - sed -i "$ a appVersion: ${GITHUB_REF##*/}" helm/blueapi/Chart.yaml - helm dependencies update helm/blueapi - helm package helm/blueapi --version ${GITHUB_REF##*/} -d /tmp/ - helm push /tmp/blueapi-${GITHUB_REF##*/}.tgz oci://ghcr.io/diamondlightsource/charts