|
12 | 12 | jobs:
|
13 | 13 | docker:
|
14 | 14 | runs-on: ubuntu-22.04
|
15 |
| - name: Docker Push |
| 15 | + name: Docker Build and Push |
16 | 16 | steps:
|
17 | 17 | - uses: actions/checkout@v4
|
18 | 18 | - name: Log in to Docker Hub
|
19 | 19 | uses: docker/login-action@v3
|
20 | 20 | with:
|
21 | 21 | username: ${{ secrets.DOCKER_HUB_USER }}
|
22 | 22 | password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
| 23 | + - name: Set up Docker Buildx |
| 24 | + uses: docker/setup-buildx-action@v3 |
| 25 | + - name: Generate Auth Token |
| 26 | + uses: actions/create-github-app-token@v1 |
| 27 | + id: app-token |
| 28 | + with: |
| 29 | + app-id: ${{ secrets.APP_ID }} |
| 30 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
23 | 31 | - name: Build test image
|
24 | 32 | id: docker-build-test
|
25 | 33 | uses: docker/build-push-action@v5
|
26 | 34 | with:
|
27 | 35 | target: test
|
28 | 36 | push: false
|
| 37 | + load: true |
| 38 | + cache-from: type=gha |
| 39 | + cache-to: type=gha,mode=max |
29 | 40 | - name: Run Perl tests
|
30 | 41 | run: docker run -i ${{ steps.docker-build-test.outputs.imageid }}
|
31 | 42 | - name: Docker meta
|
|
46 | 57 | push: true
|
47 | 58 | tags: ${{ steps.meta.outputs.tags }}
|
48 | 59 | annotations: ${{ steps.meta.outputs.annotations }}
|
49 |
| - - if: contains( fromJSON(steps.meta.outputs.json).tags, "${{ github.repository }}:latest") |
50 |
| - run: echo 'need update to ${{ fromJSON(steps.meta.outputs.json).tags[0] }}' |
| 60 | + cache-from: type=gha |
| 61 | + cache-to: type=gha,mode=max |
| 62 | + - name: Update deployed image |
| 63 | + if: ${{ contains( fromJSON(steps.meta.outputs.json).tags, format('{0}:latest', github.repository)) }} |
| 64 | + uses: benc-uk/workflow-dispatch@v1 |
| 65 | + with: |
| 66 | + repo: metacpan/metacpan-k8s |
| 67 | + ref: main |
| 68 | + workflow: set-image.yml |
| 69 | + token: ${{ steps.app-token.outputs.token }} |
| 70 | + inputs: '{ "app": "api-v0-shim", "environment": "prod", "base-tag": "${{ github.repository }}:latest", "tag": "${{ fromJSON(steps.meta.outputs.json).tags[0] }}" }' |
0 commit comments