Endrer litt på logging #102
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
name: etterlatte-proxy | |
env: | |
IMAGE: ghcr.io/${{ github.repository }}/${{ github.workflow }}:${{ github.sha }} | |
APP_NAME: ${{ github.workflow }} | |
on: | |
workflow_dispatch: # Allow manually triggered workflow run | |
inputs: | |
deploy-prod: | |
description: 'Deploy til produksjon' | |
required: false | |
default: 'false' | |
push: | |
branches: | |
- main | |
paths: | |
- apps/etterlatte-proxy/** | |
jobs: | |
build-and-publish: | |
name: Build, test, and publish | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Java v17.x | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17.x | |
cache: gradle | |
- name: Gradle test and build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
chmod +x ./gradlew | |
./gradlew :apps:${APP_NAME}:test :apps:${APP_NAME}:build | |
- name: Build and publish docker image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN} | |
docker build --tag ${IMAGE} apps/${APP_NAME} | |
docker push ${IMAGE} | |
deploy-to-dev-fss: | |
name: Deploy to dev-fss | |
needs: build-and-publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: dev-fss | |
RESOURCE: apps/${{ env.APP_NAME }}/.nais/dev.yaml | |
deploy-to-prod-fss: | |
name: Deploy to prod-fss | |
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.deploy-prod == 'true' }} | |
needs: deploy-to-dev-fss | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nais/deploy/actions/deploy@v1 | |
env: | |
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | |
CLUSTER: prod-fss | |
RESOURCE: apps/${{ env.APP_NAME }}/.nais/prod.yaml |