Skip to content

Commit 5ba2804

Browse files
Bump all actions and remove deploy key
Also move from ghcr to GAR
1 parent f79fd78 commit 5ba2804

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/test-and-deploy.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Test, build and deploy
22
on: push
3-
env:
4-
IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
3+
permissions:
4+
contents: read
5+
id-token: write
56
jobs:
67
test:
78
name: Run unit tests and static analysis
@@ -44,25 +45,27 @@ jobs:
4445
run: vendor/bin/phpunit
4546

4647
- name: Run static analysis
47-
run: vendor/bin/psalm --no-cache --show-info=true
48+
run: vendor/bin/phpstan
4849

4950
- name: Check coding standard
5051
run: php-cs-fixer fix --dry-run --diff
5152

5253
build-push:
53-
name: Build and push docker container
54+
name: Build and push image
5455
runs-on: ubuntu-24.04
5556
needs: test
57+
outputs:
58+
image: ${{ steps.docker-build-push.outputs.image }}
59+
telemetry: ${{ steps.docker-build-push.outputs.telemetry }}
5660
steps:
5761
- uses: actions/checkout@v4
5862

59-
- name: Build and publish Docker image
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
run: |
63-
docker build --tag ${IMAGE} .
64-
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
65-
docker push ${IMAGE}
63+
- uses: nais/docker-build-push@v0
64+
id: docker-build-push
65+
with:
66+
team: naisdevice
67+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
68+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
6669

6770
deploy-dev-gcp:
6871
name: Deploy to dev-gcp
@@ -78,6 +81,8 @@ jobs:
7881
CLUSTER: dev-gcp
7982
RESOURCE: .nais/nais.yml
8083
VARS: .nais/dev-gcp-vars.json
84+
VAR: image=${{ needs.build-push.outputs.image }}
85+
TELEMETRY: ${{ needs.build-push.outputs.telemetry }}
8186

8287
deploy-prod-gcp:
8388
if: ${{ github.ref == 'refs/heads/main' }}
@@ -94,3 +99,5 @@ jobs:
9499
CLUSTER: prod-gcp
95100
RESOURCE: .nais/nais.yml
96101
VARS: .nais/prod-gcp-vars.json
102+
VAR: image=${{ needs.build-push.outputs.image }}
103+
TELEMETRY: ${{ needs.build-push.outputs.telemetry }}

0 commit comments

Comments
 (0)