From d420ca59369f5cac0b9c7d0757b0d6a1bd72d0b8 Mon Sep 17 00:00:00 2001 From: Nils Martin Sande Date: Tue, 28 May 2024 10:06:09 +0200 Subject: [PATCH] La til deploy til dev for formidlingsgruppe-utgang --- .../utgang-formidlingsgruppe-deploy.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/utgang-formidlingsgruppe-deploy.yaml diff --git a/.github/workflows/utgang-formidlingsgruppe-deploy.yaml b/.github/workflows/utgang-formidlingsgruppe-deploy.yaml new file mode 100644 index 00000000..15eae7fa --- /dev/null +++ b/.github/workflows/utgang-formidlingsgruppe-deploy.yaml @@ -0,0 +1,73 @@ +name: Formidlingsgruppe - Utgang + +on: + push: + branches: + - main + paths: + - 'apps/utgang-formidlingsgruppe/**' + - 'lib/kafka-key-generator-client/**' + - 'domain/main-avro-schema/**' + - '.github/workflows/utgang-formidlingsgruppe-deploy.yaml' + - 'gradle/**' + - 'settings.gradle.kts' + - 'gradle.properties' + - 'gradlew' + +env: + IMAGE: europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/paw/paw-arbeidssoekerregisteret-utgang-formidlingsgruppe +jobs: + build: + name: Build and push Docker container + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + packages: write + outputs: + image: ${{ steps.docker-build-push.outputs.image }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: temurin + cache: gradle + - name: set module to build + run: echo "MODULE=utgang-formidlingsgruppe" >> $GITHUB_ENV + - name: Set version + run: echo "VERSION=$(date +'%y.%m.%d').${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV + - name: Login GAR + uses: nais/login@v0 + with: + project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} + identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} + team: paw + - name: Build and push image + id: docker-build-push + working-directory: ./ + run: | + echo "image=${{ env.IMAGE }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT + echo -Pversion=${{ env.VERSION }} -Pimage=${{ env.IMAGE }} ${{ env.MODULE }}:build ${{ env.MODULE }}:test ${{ env.MODULE }}:jib + ./gradlew -Pversion=${{ env.VERSION }} -Pimage=${{ env.IMAGE }} ${{ env.MODULE }}:build ${{ env.MODULE }}:test ${{ env.MODULE }}:jib + echo "DIGEST=$(cat ${{ env.MODULE }}/build/jib-image.digest)" >> $GITHUB_ENV + env: + ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} + - name: Attest and sign + uses: nais/attest-sign@v1.3.4 + with: + image_ref: ${{ env.IMAGE }}@${{ env.DIGEST }} + deploy-dev: + name: Deploy to dev-gcp + permissions: + contents: read + id-token: write + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: nais/deploy/actions/deploy@v2 + env: + CLUSTER: dev-gcp + RESOURCE: apps/utgang-formidlingsgruppe/nais/nais-dev.yaml + VAR: image=${{ needs.build.outputs.image }},kafka=nav-dev