From 118c9b4209589c12f65f48f733df057a2ccc44c0 Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Thu, 4 Apr 2024 15:15:08 +0200 Subject: [PATCH] chore(release-candidate): improve workflow --- .github/workflows/release_candidate.yml | 83 ++++++------------------- 1 file changed, 18 insertions(+), 65 deletions(-) diff --git a/.github/workflows/release_candidate.yml b/.github/workflows/release_candidate.yml index 3ac6e0d..5118dad 100644 --- a/.github/workflows/release_candidate.yml +++ b/.github/workflows/release_candidate.yml @@ -25,72 +25,25 @@ on: - 'release/v*.*.*-rc*' workflow_dispatch: -env: - IMAGE_NAMESPACE: "tractusx" - IMAGE_NAME_SERVICE: "policy-hub-service" - IMAGE_NAME_MIGRATIONS: "policy-hub-migrations" - jobs: - policy-hub-service-release: + release-images: runs-on: ubuntu-latest permissions: contents: read - + strategy: + matrix: + include: + - image: tractusx/policy-hub-service + dockerfile: ./docker/Dockerfile-policy-hub-service + dockernotice: ./docker/notice-policy-hub-service.md + - image: tractusx/policy-hub-migrations + dockerfile: ./docker/Dockerfile-policy-hub-migrations + dockernotice: ./docker/notice-policy-hub-migrations.md steps: - - name: Checkout repository + - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - - name: Login to DockerHub - if: github.event_name != 'pull_request' - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 with: - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_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 - - - name: Docker meta - id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 - with: - images: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME_SERVICE }} - tags: | - type=raw,value=rc - type=raw,value=${{ github.sha }} - - - name: Build and push Docker image - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 - with: - context: . - file: docker/Dockerfile-policy-hub-service - platforms: linux/amd64, linux/arm64 - pull: true - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - # https://github.com/peter-evans/dockerhub-description - - name: Update Docker Hub description - if: github.event_name != 'pull_request' - uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 - with: - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME_SERVICE }} - readme-filepath: "./docker/notice-policy-hub-service.md" - - policy-hub-migrations-release: - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + fetch-depth: 0 - name: Login to DockerHub if: github.event_name != 'pull_request' @@ -109,16 +62,16 @@ jobs: id: meta uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 with: - images: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME_MIGRATIONS }} + images: ${{ matrix.image }} tags: | type=raw,value=rc type=raw,value=${{ github.sha }} - - name: Build and push Docker image - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + - name: Build and push Docker images + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 with: context: . - file: docker/Dockerfile-policy-hub-migrations + file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 pull: true push: ${{ github.event_name != 'pull_request' }} @@ -132,5 +85,5 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME_MIGRATIONS }} - readme-filepath: "./docker/notice-policy-hub-migrations.md" + repository: ${{ matrix.image }} + readme-filepath: ${{ matrix.dockernotice }}