Skip to content

Bygg og deploy - Labs #1

Bygg og deploy - Labs

Bygg og deploy - Labs #1

name: Bygg og deploy - Labs
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * 1-5'
jobs:
build:
name: Bygg
permissions:
contents: read
id-token: write
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
runs-on: ubuntu-latest
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Oppsett Java 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Bygg og test med Maven
run: mvn package -B -Dsurefire.useFile=false
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
byosbom: target/bom.json
team: arbeidsgiver
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
deploy-gcp-labs:
name: Deploy til gcp (gamle labs)
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- name: Sjekk ut kode
uses: actions/checkout@v4
- name: Generer tiltaksgjennomforing-wiremock configmap
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
./kubectl create configmap --dry-run=client -o yaml --from-file src/test/resources/mappings -n arbeidsgiver tiltaksgjennomforing-wiremock > nais/wiremock-mappings.yaml
cat nais/wiremock-mappings.yaml # debug
- name: Deploy til gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: nais/dev-gcp-labs.yaml,nais/wiremock.yaml,nais/wiremock-mappings.yaml
VAR: image=${{ needs.build.outputs.image }},deploytrigger=${{ github.run_number }}