@@ -7,8 +7,16 @@ permissions:
77 contents : read
88 issues : write
99jobs :
10- push :
10+ docker-push :
11+ uses : ./.github/actions/docker-publish.yml
12+ secrets :
13+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
14+ DOCKERHUB_PASSWORD : ${{ secrets.DOCKERHUB_PASSWORD }}
15+
16+ handle-failure :
1117 runs-on : ubuntu-latest
18+ needs : docker-push
19+ if : ${{ failure() }}
1220 steps :
1321 - uses : GitHubSecurityLab/actions-permissions/monitor@v1
1422 with :
@@ -17,43 +25,22 @@ jobs:
1725 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
1826 with :
1927 persist-credentials : false
20- - name : Set up Docker Buildx
21- uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
22- - name : Login to Docker Hub
23- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
24- with :
25- username : " ${{ secrets.DOCKERHUB_USERNAME }}"
26- password : " ${{ secrets.DOCKERHUB_PASSWORD }}"
27- - name : Set date and version
28- id : set-properties
28+ - name : Get version and date
29+ id : release-meta
2930 run : |
30- DATE=$(date +'%Y-%m-%d')
3131 VERSION=$(npm pkg get version | tr -d '"')
32- echo " DATE=${DATE}" >> "$GITHUB_OUTPUT"
32+ DATE=$(date +'%Y-%m-%d')
3333 echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
34- - name : Build and push image to dockerhub registry
35- uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
36- with :
37- context : .
38- platforms : linux/amd64,linux/arm64
39- tags : ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:latest, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.set-properties.outputs.VERSION }}, ${{ vars.DOCKERHUB_IMAGE_REPOSITORY }}:${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
40- file : Dockerfile
41- push : true
42- provenance : mode=max
43- sbom : true
44- build-args : |
45- VERSION=${{ steps.set-properties.outputs.VERSION }}
34+ echo "DATE=${DATE}" >> "$GITHUB_OUTPUT"
4635 - uses : mongodb-js/devtools-shared/actions/setup-bot-token@main
4736 id : app-token
48- if : ${{ failure() }}
4937 with :
5038 app-id : ${{ vars.DEVTOOLS_BOT_APP_ID }}
5139 private-key : ${{ secrets.DEVTOOLS_BOT_PRIVATE_KEY }}
5240 - name : Create Issue
53- if : ${{ failure() }}
5441 uses : imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
5542 with :
5643 token : ${{ steps.app-token.outputs.token }}
57- title : Release Failure for Docker Image ${{ steps.set-properties .outputs.VERSION }}-${{ steps.set-properties .outputs.DATE }}
44+ title : Release Failure for Docker Image ${{ steps.release-meta .outputs.VERSION }}-${{ steps.release-meta .outputs.DATE }}
5845 body : See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
5946 labels : " docker, release_failure"
0 commit comments