Skip to content

Merge pull request #238 from navikt/snyk-upgrade-32ce294e169d3d711f4a… #63

Merge pull request #238 from navikt/snyk-upgrade-32ce294e169d3d711f4a…

Merge pull request #238 from navikt/snyk-upgrade-32ce294e169d3d711f4a… #63

Workflow file for this run

name: Deploy to prod
on:
push:
branches:
- 'main'
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
permissions:
contents: "read"
id-token: "write"
name: Build with maven and docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn -Dmaven.test.skip=true -B -e --settings .m2/maven-settings.xml clean install
- uses: nais/docker-build-push@v0
id: docker-push
with:
team: bidrag
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-push.outputs.image }}
tag: ${{ steps.docker-push.outputs.tag }}
deploy:
runs-on: ubuntu-latest
name: Deploy to prod
needs: build
steps:
- uses: actions/checkout@v3
with:
path: deploy
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: deploy/.nais/nais.yaml
VARS: deploy/.nais/prod.yaml
IMAGE: ${{ needs.build.outputs.image }}
outputs:
image: ${{ needs.build.outputs.image }}
tag: ${{ needs.build.outputs.tag }}
tag:
runs-on: ubuntu-latest
name: Tag release
permissions:
contents: write
needs: deploy
steps:
- uses: actions/checkout@v3
- name: Push latest image tag as github tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.deploy.outputs.tag }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}