-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 1.83 KB
/
publish_docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
name: Publish docker image
on:
workflow_run:
workflows: ['CI']
branches: [master]
types:
- completed
permissions:
contents: read
packages: write
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMG_NAME: geoblocks/ngv-ui
DOCKER_TAG: latest
jobs:
build_and_publish:
name: Build and publish
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ngv
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMG_NAME }}:${{ env.DOCKER_TAG }}
- name: Update images sha
id: get_image_sha
run: echo "img_sha=$(docker inspect --format='{{index .RepoDigests 0}}' '${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMG_NAME }}:${{ env.DOCKER_TAG }}' | cut -d':' -f2)" >> "$GITHUB_OUTPUT";
outputs:
docker_image_sha: ${{ steps.get_image_sha.outputs.img_sha }}
trigger_deploy:
name: Trigger deploy on lab
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
needs: build_and_publish
steps:
- name: Deploy Stage
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_PAT_DEPLOY }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'camptocamp',
repo: 'argocd-gs-plg-apps',
workflow_id: 'update-ngv-image.yaml',
ref: 'main',
inputs: {
img_sha: '${{ needs.build_and_publish.outputs.docker_image_sha }}'
}
});