From 834a5cbf03f25a2d5ba22f25e01dbce849d8c483 Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Thu, 28 Mar 2024 12:00:51 +0100 Subject: [PATCH] test: test image build with chart release --- .github/workflows/chart-release.yaml | 64 ++++++++++++++++++++++++++-- charts/dim/Chart.yaml | 4 +- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/.github/workflows/chart-release.yaml b/.github/workflows/chart-release.yaml index 4e397f4..845ef11 100644 --- a/.github/workflows/chart-release.yaml +++ b/.github/workflows/chart-release.yaml @@ -17,7 +17,7 @@ # SPDX-License-Identifier: Apache-2.0 ############################################################### -name: Release Chart +name: Release on: workflow_dispatch: @@ -27,8 +27,14 @@ on: branches: - main +env: + REGISTRY: ghcr.io + IMAGE_NAME_SERVICE: ${{ github.repository }}_dim-service + IMAGE_NAME_MIGRATIONS: ${{ github.repository }}_dim-migrations + IMAGE_NAME_WORKER: ${{ github.repository }}_dim-processes-worker + jobs: - release: + release-helm-chart: # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token permissions: @@ -83,4 +89,56 @@ jobs: run: | git tag v${{ steps.chart-version.outputs.current }} git push origin v${{ steps.chart-version.outputs.current }} - if: steps.version-check.outputs.exists == 'false' \ No newline at end of file + if: steps.version-check.outputs.exists == 'false' + + service-release: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 + + # Create SemVer or ref tags dependent of trigger event + - name: Docker meta + id: meta + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 + with: + images: | + ${{ env.REGISTRY}}/${{ env.IMAGE_NAME_SERVICE }} + # Automatically prepare image tags; See action docs for more examples. + # semver patter will generate tags like these for example :1 :1.2 :1.2.3 + tags: | + type=ref,event=branch + type=ref,event=pr + type=raw,value=latest + type=semver,pattern={{version}} + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + + - name: Build and push Docker image + uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + with: + context: . + file: docker/Dockerfile-dim-service + platforms: linux/amd64, linux/arm64 + pull: true + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/charts/dim/Chart.yaml b/charts/dim/Chart.yaml index 669163c..39c87bf 100644 --- a/charts/dim/Chart.yaml +++ b/charts/dim/Chart.yaml @@ -20,8 +20,8 @@ apiVersion: v2 name: dim type: application -version: 0.0.2 -appVersion: 0.0.2 +version: 0.0.3 +appVersion: 0.0.3 description: Helm chart for DIM Middle Layer home: https://github.com/catenax-ng/dim-repo dependencies: