Skip to content

Commit

Permalink
update deployed image on merge to master
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed May 7, 2024
1 parent c631a64 commit 7ba7b8d
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@ on:
jobs:
docker:
runs-on: ubuntu-22.04
name: Docker Push
name: Docker Build and Push
steps:
- uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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
with:
target: test
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Perl tests
run: docker run -i ${{ steps.docker-build-test.outputs.imageid }}
- name: Docker meta
Expand All @@ -46,5 +57,14 @@ 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] }}'
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update deployed image
if: ${{ contains( fromJSON(steps.meta.outputs.json).tags, format('{0}:latest', github.repository)) }}
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] }}" }'

0 comments on commit 7ba7b8d

Please sign in to comment.