|
18 | 18 | id-token: write
|
19 | 19 | steps:
|
20 | 20 | - uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v3
|
| 21 | + - name: Determine what to do |
| 22 | + id: changed-files |
| 23 | + shell: python |
| 24 | + env: |
| 25 | + RESOURCES: nais/nais.yaml,nais/topic.yaml |
| 26 | + run: | |
| 27 | + import os |
| 28 | + import glob |
| 29 | + from itertools import chain |
| 30 | + import subprocess |
| 31 | + |
| 32 | + changed_files=set(subprocess.run(["git", "diff", "--name-only", "${{ github.event.before }}", "${{ github.event.after }}"], capture_output=True, text=True).stdout.splitlines()) |
| 33 | + resource_files = set(chain(*(glob.glob(f) for f in os.getenv("RESOURCES", "").split(",")))) |
| 34 | + if changed_files < resource_files: |
| 35 | + print("Only resources have been changed") |
| 36 | + output = "only-resources" |
| 37 | + elif resource_files.isdisjoint(changed_files): |
| 38 | + print("No resources have been changed") |
| 39 | + output = "non-resources" |
| 40 | + else: |
| 41 | + output = "all" |
| 42 | + |
| 43 | + with open(os.getenv("GITHUB_OUTPUT"), "a") as f: |
| 44 | + f.write(f"changed={output}\n") |
21 | 45 | - uses: nais/platform-build-push-sign@main
|
22 | 46 | id: build-push-sign
|
| 47 | + if: steps.changed-files.outputs.changed != 'only-resources' |
23 | 48 | with:
|
24 | 49 | name: karapace
|
25 | 50 | google_service_account: gh-karapace
|
|
34 | 59 | needs: build
|
35 | 60 | steps:
|
36 | 61 | - uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v2
|
37 |
| - - uses: nais/deploy/actions/deploy@0bca2c7e607d30fd757a2a23fb7d07b3ff96d540 # ratchet:nais/deploy/actions/deploy@v1 |
| 62 | + - uses: nais/deploy/actions/deploy@v2 |
38 | 63 | env:
|
39 | 64 | APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
|
40 | 65 | CLUSTER: dev-gcp
|
41 | 66 | RESOURCE: nais/nais.yaml,nais/topic.yaml
|
42 |
| - VAR: image=${{ needs.build.outputs.image }} |
| 67 | + WORKLOAD_IMAGE: ${{ needs.build.outputs.image }} |
0 commit comments