Skip to content

Merge branch 'main' into dependabot/maven/com.pinterest-ktlint-0.50.0 #939

Merge branch 'main' into dependabot/maven/com.pinterest-ktlint-0.50.0

Merge branch 'main' into dependabot/maven/com.pinterest-ktlint-0.50.0 #939

name: Build-Deploy-Preprod
on:
workflow_dispatch:
push:
branches-ignore:
# build-deploy-prod deployer allerede til dev, dette førte til en race condition som stopper deploy til prod
- 'main'
env:
IMAGE: ghcr.io/${{ github.repository }}/familie-baks-soknad-api:${{ github.sha }}
jobs:
deploy-to-dev:
name: Bygg app/image, push til github, deploy til dev-gcp
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-cache-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-cache-
- name: Bygg med maven + sonar
env:
SONAR_PROJECTKEY: ${{ secrets.SONAR_PROJECTKEY }}
SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }}
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#run: mvn -B --no-transfer-progress package verify sonar:sonar --settings .m2/maven-settings.xml --file pom.xml
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Bygg Docker image
run: |
docker build -t $IMAGE .
- name: Login to Github Package Registry
env:
DOCKER_USERNAME: x-access-token
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin ghcr.io
- name: Push Docker image
run: docker push $IMAGE
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: dev-gcp-teamfamilie.yaml