This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Vetle Hollund <[email protected]> Co-authored-by: Robin Tordly<[email protected]>
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||
|