9
9
- master
10
10
11
11
jobs :
12
- changes :
12
+ # This job ensures image is only deployed when files that make up the image are changed
13
+ # (changing docs or build scripts won't result in a push to registry)
14
+ filters :
13
15
runs-on : ubuntu-latest
14
16
outputs :
15
- noop : ${{ steps.filter.outputs.noop }}
17
+ found_main_image_changes : ${{ steps.filter.outputs.main_image_files }}
18
+ found_minimal_image_changes : ${{ steps.filter.outputs.minimal_image_files }}
16
19
steps :
17
20
- uses : actions/checkout@v2
18
21
19
22
if : ${{ github.event_name == 'push'}}
20
23
id : filter
21
24
with :
22
- filters : |
23
- image:
24
- - 'root/**'
25
- - Dockerfile
25
+ filters : ' .github/filters.yml'
26
26
27
27
release :
28
28
runs-on : ubuntu-latest
29
- needs : changes
30
- if : ${{ github.event_name == 'repository_dispatch' || needs.changes .outputs.image == 'true'}}
29
+ needs : filters
30
+ if : github.event_name == 'repository_dispatch' || needs.filters .outputs.found_main_changes == 'true'
31
31
strategy :
32
32
matrix :
33
33
tags : ['latest','%X%', '%X.Y%', '%X.Y.Z%']
@@ -36,15 +36,14 @@ jobs:
36
36
steps :
37
37
- uses : actions/checkout@v2
38
38
- name : Get Tag if push
39
- id : get-octoprint-release
40
- if : ${{ github.event_name == 'push'}}
39
+ id : latest-octoprint
41
40
uses : pozetroninc/github-action-get-latest-release@master
42
41
with :
43
42
owner : OctoPrint
44
43
repo : OctoPrint
45
44
- name : Set Tag on Push
46
45
if : ${{ github.event_name == 'push'}}
47
- run : echo "::set-env name=tag_name::${{ steps.get -octoprint-release .outputs.release }}"
46
+ run : echo "::set-env name=tag_name::${{ steps.latest -octoprint.outputs.release }}"
48
47
- name : Set Tag on dispatch
49
48
if : ${{ github.event_name == 'repository_dispatch' }}
50
49
run : echo "::set-env name=tag_name::${{ github.event.client_payload.tag_name }}"
69
68
70
69
- name : Build and Deploy
71
70
id : build_deploy
71
+ # if matrix tag is latest AND tag_name is NOT equal to latest-octoprint don't build
72
+ # this allows rebuilds of older versions without changing 'latest' to an old release
73
+ if : !(env.tag_name == 'latest' && ( steps.latest-octprint.outputs.release != env.tag_name ))
72
74
run : |
73
75
docker buildx build --push \
74
76
--platform linux/arm64,linux/amd64,linux/arm/v7 \
0 commit comments