@@ -2,8 +2,7 @@ name: Rebuild and publish new ubcdsci/py-intro-to-ds image on DockerHub
2
2
on :
3
3
pull_request :
4
4
types : [opened, synchronize]
5
- paths :
6
- - Dockerfile
5
+
7
6
jobs :
8
7
rebuild-docker :
9
8
name : Rebuild docker image
@@ -21,20 +20,15 @@ jobs:
21
20
run : |
22
21
echo "GitHub PR action type: ${{ github.event.action }}"
23
22
echo "Checking if the PR modifies the Dockerfile"
24
- if [[ ${{ github.event.action }} == 'opened' ]] ; then
25
- echo "PR just opened, and it edits the Dockerfile, so rebuilding the image."
26
- echo "stale_dockerfile=true " >> "$GITHUB_OUTPUT"
23
+ if git diff --quiet ${{ github.event.before }} ${{ github.event.after }} Dockerfile ; then
24
+ echo "PR synchronized, but Dockerfile was not edited. Not rebuilding the image."
25
+ echo "stale_dockerfile=false " >> "$GITHUB_OUTPUT"
27
26
else
28
- if git diff --quiet ${{ github.event.before }} ${{ github.event.after }} Dockerfile; then
29
- echo "PR synchronized, but Dockerfile was not edited. Not rebuilding the image."
30
- echo "stale_dockerfile=false" >> "$GITHUB_OUTPUT"
31
- else
32
- echo "PR synchronized, and Dockerfile was edited, so rebuilding the image."
33
- echo "stale_dockerfile=true" >> "$GITHUB_OUTPUT"
34
- fi
27
+ echo "PR synchronized, and Dockerfile was edited, so rebuilding the image."
28
+ echo "stale_dockerfile=true" >> "$GITHUB_OUTPUT"
35
29
fi
36
30
- name : Rebuild and publish image
37
- if : ${{steps.check-stale.outputs.stale_dockerfile == true }}
31
+ if : ${{ steps.check-stale.outputs.stale_dockerfile == ' true' }}
38
32
id : rebuild
39
33
uses : elgohr/Publish-Docker-Github-Action@v5
40
34
with :
44
38
dockerfile : Dockerfile
45
39
snapshot : true
46
40
- name : Update build_html.sh script
47
- if : ${{steps.check-stale.outputs.stale_dockerfile == true }}
41
+ if : ${{ steps.check-stale.outputs.stale_dockerfile == ' true' }}
48
42
run : |
49
43
git config --local user.email "[email protected] "
50
44
git config --local user.name "GitHub Action"
54
48
git add build_html.sh
55
49
git commit -m "update build_html.sh script with new docker image"
56
50
- name : Update build_pdf.sh script
57
- if : ${{steps.check-stale.outputs.stale_dockerfile == true }}
51
+ if : ${{ steps.check-stale.outputs.stale_dockerfile == ' true' }}
58
52
run : |
59
53
git config --local user.email "[email protected] "
60
54
git config --local user.name "GitHub Action"
64
58
git add build_pdf.sh
65
59
git commit -m "update build_pdf.sh script with new docker image"
66
60
- name : Push changes to build scripts
67
- if : ${{steps.check-stale.outputs.stale_dockerfile == true }}
61
+ if : ${{ steps.check-stale.outputs.stale_dockerfile == ' true' }}
68
62
uses : ad-m/github-push-action@master
69
63
with :
70
64
github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments