Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
workflow som kan deploye branches
Browse files Browse the repository at this point in the history
Co-authored-by: Vetle Hollund <[email protected]>
Co-authored-by: Robin Tordly<[email protected]>
  • Loading branch information
sturleh and VHollund committed Nov 13, 2023
1 parent 2267da5 commit 1198c6a
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/deploy-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build PR or branch

on:
push:
branches:
- 'deploy/**'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_BASE: europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/aap/${{ github.event.repository.name }}

jobs:
bygg:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
outputs:
image: ${{ steps.kompiler-pr.outputs.image }}
steps:
- name: Print number of PR
run: echo The Title of your PR is ${{ github.event.pull_request.number }}

- name: Sjekk ut kode
uses: actions/[email protected]


- name: Setter opp Java 17
uses: actions/[email protected]
with:
java-version: 17
distribution: temurin
cache: maven

- name: Setter tag-navn
run: echo "TAG=$(date +%Y.%m.%d.%H%M%S)-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Setter image-navn
run: echo "IMAGE=$(echo $IMAGE_BASE):$(echo $TAG)-PR${{ steps.kompiler-pr.outputs.image }}" >> $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: aap

- name: Kompiler
id: kompiler-pr
run: |
echo "image=${{ env.IMAGE }}" >> $GITHUB_OUTPUT
./mvnw --batch-mode --settings .github/.m2/settings.xml -DGAR_TOKEN=${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} package jib:build
deploy:

name: Deploy til dev-gcp
needs: bygg
runs-on: ubuntu-latest
timeout-minutes: 30
environment: dev-gcp:aap
env:
PRINT_PAYLOAD: true
APIKEY: ${{secrets.NAIS_DEPLOY_APIKEY}}
RESOURCE: .nais/naiserator.yaml,.nais/dev-gcp-alerts.yaml
CLUSTER: dev-gcp
VARS: .nais/$dev-gcp.json
IMAGE: ${{needs.bygg.outputs.image}}
steps:
- uses: actions/[email protected]
- uses: nais/deploy/actions/deploy@master

0 comments on commit 1198c6a

Please sign in to comment.