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

WIP - bug fix ift. kjøring #174

WIP - bug fix ift. kjøring

WIP - bug fix ift. kjøring #174

name: Bygg og publiser docker-image for main
on:
push:
branches:
- master
- main
paths-ignore:
- .github/workflows/**
- README.md
- howto.md
permissions:
contents: write
packages: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
image: ${{ env.IMAGE }}
steps:
- name: Sjekk ut koden
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: '17.x'
- name: Finn cache-variabler
uses: navikt/pb-common-gh-actions/cache-prep@v2
- name: Sett opp cache
uses: actions/cache@v2
with:
path: |
${{ env.CACHE_PATHS }}
key: ${{ runner.os }}${{ env.CACHE_KEY_NAMESPACE }}${{ hashFiles(env.CACHE_KEY_HASHED_PATH) }}
- name: Bygg prosjekt og kjør tester
uses: navikt/pb-common-gh-actions/build@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bygg, tag og push Docker image
uses: navikt/pb-common-gh-actions/docker-publish@v2
with:
TAG_LATEST: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag release i git-repo-et
run: |
TAG="$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S')-$(git log -1 --pretty='%h')"
git config user.name "Team Personbruker CI"
git config user.email "personbruker@nav.no"
git tag $TAG
git push origin $TAG
deploy:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
cluster: [dev-gcp, prod-gcp]
steps:
- name: Sjekk ut koden
uses: actions/checkout@v2
- name: 'Sjekk om deploy til ${{ matrix.cluster }} er mulig'
run: echo "DEPLOY_CONFIG_DEFINED=$([[ -f ./nais/${{ matrix.cluster }}/nais.yaml ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
- name: 'Deploy-er til ${{ matrix.cluster }}'
if: env.DEPLOY_CONFIG_DEFINED == 'true'
uses: 'nais/deploy/actions/deploy@v1'
env:
REF: ${{ github.sha }}
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: ${{ matrix.cluster }}
RESOURCE: ./nais/${{ matrix.cluster }}/nais.yaml
VAR: version=${{ needs.build.outputs.image }}
PRINT_PAYLOAD: true