|
1 | 1 | name: Test, build and deploy
|
2 | 2 | on: push
|
3 |
| -env: |
4 |
| - IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }} |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + id-token: write |
5 | 6 | jobs:
|
6 | 7 | test:
|
7 | 8 | name: Run unit tests and static analysis
|
@@ -44,25 +45,27 @@ jobs:
|
44 | 45 | run: vendor/bin/phpunit
|
45 | 46 |
|
46 | 47 | - name: Run static analysis
|
47 |
| - run: vendor/bin/psalm --no-cache --show-info=true |
| 48 | + run: vendor/bin/phpstan |
48 | 49 |
|
49 | 50 | - name: Check coding standard
|
50 | 51 | run: php-cs-fixer fix --dry-run --diff
|
51 | 52 |
|
52 | 53 | build-push:
|
53 |
| - name: Build and push docker container |
| 54 | + name: Build and push image |
54 | 55 | runs-on: ubuntu-24.04
|
55 | 56 | needs: test
|
| 57 | + outputs: |
| 58 | + image: ${{ steps.docker-build-push.outputs.image }} |
| 59 | + telemetry: ${{ steps.docker-build-push.outputs.telemetry }} |
56 | 60 | steps:
|
57 | 61 | - uses: actions/checkout@v4
|
58 | 62 |
|
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 }} |
66 | 69 |
|
67 | 70 | deploy-dev-gcp:
|
68 | 71 | name: Deploy to dev-gcp
|
|
78 | 81 | CLUSTER: dev-gcp
|
79 | 82 | RESOURCE: .nais/nais.yml
|
80 | 83 | VARS: .nais/dev-gcp-vars.json
|
| 84 | + VAR: image=${{ needs.build-push.outputs.image }} |
| 85 | + TELEMETRY: ${{ needs.build-push.outputs.telemetry }} |
81 | 86 |
|
82 | 87 | deploy-prod-gcp:
|
83 | 88 | if: ${{ github.ref == 'refs/heads/main' }}
|
|
94 | 99 | CLUSTER: prod-gcp
|
95 | 100 | RESOURCE: .nais/nais.yml
|
96 | 101 | VARS: .nais/prod-gcp-vars.json
|
| 102 | + VAR: image=${{ needs.build-push.outputs.image }} |
| 103 | + TELEMETRY: ${{ needs.build-push.outputs.telemetry }} |
0 commit comments