From 457f6430f06a4ee42e9cb3a10b85dfdc22095b62 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 6 May 2024 23:20:36 +0200 Subject: [PATCH] update deployed image on merge to master --- .github/workflows/build-container.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index a8711fb..bc658b4 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -20,6 +20,12 @@ jobs: with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} + - name: Generate Auth Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Build test image id: docker-build-test uses: docker/build-push-action@v5 @@ -46,5 +52,12 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} annotations: ${{ steps.meta.outputs.annotations }} - - if: contains( fromJSON(steps.meta.outputs.json).tags, "${{ github.repository }}:latest") - run: echo 'need update to ${{ fromJSON(steps.meta.outputs.json).tags[0] }}' + - name: Update deployed image + if: ${{ contains( fromJSON(steps.meta.outputs.json).tags, "${{ github.repository }}:latest") }} + uses: benc-uk/workflow-dispatch@v1 + with: + repo: metacpan/metacpan-k8s + ref: main + workflow: set-image.yml + token: ${{ steps.app-token.outputs.token }} + inputs: '{ "app": "api-v0-shim", "environment": "prod", "base-tag": "${{ github.repository }}:latest", "tag": "${{ fromJSON(steps.meta.outputs.json).tags[0] }}" }'