Skip to content

Merge pull request #443 from navikt/chore/oppdater-readme #155

Merge pull request #443 from navikt/chore/oppdater-readme

Merge pull request #443 from navikt/chore/oppdater-readme #155

name: Build, og deploy (dev og prod)
on:
push:
branches:
- 'master'
env:
IMAGE: ghcr.io/navikt/familie-dokument:${{ github.sha }}
IMAGE_LATEST: ghcr.io/navikt/familie-dokument:latest
jobs:
build-and-deploy:
name: Build, push til docker, og deploy til GCP (dev)
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Bygg med maven
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Bygg Docker image
run: |
docker build -t ${IMAGE} -t ${IMAGE_LATEST} .
- name: Login to Github Package Registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
- name: Push Docker image med versjonstag
run: docker push ${IMAGE}
- name: Push Docker image med 'latest' tag
run: docker push ${IMAGE_LATEST}
- name: Deploy til GCP (dev)
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .deploy/nais-dev.yaml
- name: Deploy til GCP (prod)
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .deploy/nais-prod.yaml