Bare deploy branch til dev #183
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
jobs: | |
build: | |
name: Build and publish Docker image | |
runs-on: ubuntu-latest | |
permissions: # Sjekk https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- uses: gradle/[email protected] | |
- uses: gradle/[email protected] | |
env: | |
# Eksluder test dependencies | |
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: compileClasspath|runtimeClasspath | |
with: | |
gradle-version: wrapper | |
dependency-graph: generate-and-submit | |
arguments: --configuration-cache build installDist | |
- name: docker-build-push | |
uses: nais/docker-build-push@v0 | |
if: github.ref == 'refs/heads/feature/støtte_fnr' | |
id: docker-build-push | |
with: | |
team: teamdagpenger | |
push_image: true # optional, default true | |
tag: ${{ github.sha }} | |
dockerfile: Dockerfile # optional, default Dockerfile | |
docker_context: . # optional, default . | |
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | |
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | |
- name: Archive NAIS yaml | |
if: github.ref == 'refs/heads/feature/støtte_fnr' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nais-yaml | |
path: .nais | |
outputs: | |
image: ${{ steps.docker-build-push.outputs.image }} | |
deploy-dev: | |
name: Deploy to dev | |
needs: [build] | |
if: github.ref == 'refs/heads/feature/støtte_fnr' | |
runs-on: ubuntu-latest | |
environment: dev-fss | |
steps: | |
- name: Fetch NAIS yaml | |
uses: actions/download-artifact@v4 | |
with: | |
name: nais-yaml | |
path: .nais | |
- uses: nais/deploy/actions/deploy@v2 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-fss | |
RESOURCE: .nais/nais.yaml | |
VAR: image=${{ needs.build.outputs.image }} | |
VARS: .nais/dev-vars.yaml | |
PRINT_PAYLOAD: true | |
# deploy-prod: | |
# name: Deploy to Production | |
# needs: [build, deploy-dev] | |
# if: github.ref == 'refs/heads/feature/støtte_fnr' | |
# runs-on: ubuntu-latest | |
# environment: prod-fss | |
# steps: | |
# - name: Fetch NAIS yaml | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: nais-yaml | |
# path: .nais | |
# | |
# - uses: nais/deploy/actions/deploy@v2 | |
# env: | |
# APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
# CLUSTER: prod-fss | |
# RESOURCE: .nais/nais.yaml | |
# VAR: image=${{ needs.build.outputs.image }} | |
# VARS: .nais/prod-vars.yaml | |
# PRINT_PAYLOAD: true |