@@ -7,7 +7,7 @@ concurrency:
7
7
on :
8
8
push :
9
9
paths-ignore :
10
- - " *.md"
10
+ - " *.md"
11
11
12
12
jobs :
13
13
build :
@@ -20,43 +20,14 @@ jobs:
20
20
pull-requests : read
21
21
steps :
22
22
- uses : " actions/checkout@v4"
23
- with :
24
- fetch-depth : 0
25
- - name : Find start and end SHAs
26
- uses : nrwl/nx-set-shas@v4
27
- id : last-successful-commit-push
28
- with :
29
- main-branch-name : main
30
23
- name : Determine what to do
31
24
id : changed-files
32
- shell : python
33
- env :
34
- RESOURCES : nais/nais.yaml,nais/topic.yaml
35
- run : |
36
- import os
37
- import glob
38
- from itertools import chain
39
- import subprocess
40
-
41
- changed_files=set(subprocess.run(["git", "diff", "--name-only", "${{ steps.last-successful-commit-push.outputs.base }}", "${{ steps.last-successful-commit-push.outputs.head }}"], capture_output=True, text=True).stdout.splitlines())
42
- print(f"::debug::Changed files: {changed_files}")
43
- resource_files = set(chain(*(glob.glob(f) for f in os.getenv("RESOURCES", "").split(","))))
44
- print(f"::debug::Resource files: {resource_files}")
45
-
46
- if changed_files < resource_files:
47
- print("Only resources have been changed")
48
- output = "only-resources"
49
- elif resource_files.isdisjoint(changed_files):
50
- print("No resources have been changed")
51
- output = "non-resources"
52
- else:
53
- output = "all"
54
-
55
- with open(os.getenv("GITHUB_OUTPUT"), "a") as f:
56
- f.write(f"changed={output}\n")
25
+ uses : " nais/what-changed@main"
26
+ with :
27
+ files : " nais/nais.yaml,nais/topic.yaml"
57
28
- uses : nais/platform-build-push-sign@main
58
29
id : build-push-sign
59
- if : steps.changed-files.outputs.changed != 'only-resources '
30
+ if : steps.changed-files.outputs.changed != 'only-inputs '
60
31
with :
61
32
name : karapace
62
33
google_service_account : gh-karapace
@@ -74,19 +45,18 @@ jobs:
74
45
- uses : " actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v2
75
46
- uses : nais/deploy/actions/deploy@v2
76
47
name : Deploy resources and image if built
77
- if : needs.build.outputs.changed != 'non-resources '
48
+ if : needs.build.outputs.changed != 'non-inputs '
78
49
env :
79
50
APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
80
51
CLUSTER : dev-gcp
81
52
RESOURCE : nais/nais.yaml,nais/topic.yaml
82
53
WORKLOAD_IMAGE : ${{ needs.build.outputs.image }}
83
54
- uses : nais/deploy/actions/deploy@v2
84
55
name : Deploy only updated image
85
- if : needs.build.outputs.changed == 'non-resources '
56
+ if : needs.build.outputs.changed == 'non-inputs '
86
57
env :
87
58
APIKEY : ${{ secrets.NAIS_DEPLOY_APIKEY }}
88
59
CLUSTER : dev-gcp
89
60
WORKLOAD_NAME : karapace-test
90
61
WORKLOAD_IMAGE : ${{ needs.build.outputs.image }}
91
62
TEAM : nais
92
-
0 commit comments