Skip to content

ryddet i println's #372

ryddet i println's

ryddet i println's #372

name: Bygg og deploy omsorgsopptjening-start-innlesning til dev-gcp
on:
push:
branches:
- main
jobs:
tag_build_and_deploy:
name: 'Build, deploy and tag'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: 'Check available disk space on /tmp (1)'
run: df -h /tmp
# PULLER REPO
- name: 'Pull repo'
uses: actions/[email protected]
# SETTER DATO OG COMMIT VARIABEL
- name: 'Setter dato og commit variabel'
run: |
export TZ=CET
echo "DATE=$(date "+%Y-%m-%d--%H-%M-%S")" >> $GITHUB_ENV
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
# SETTER IMAGE VARIABEL
- name: 'Setting Image Variabel'
run: echo "IMAGE=docker.pkg.github.com/${{ github.repository }}/omsorgsopptjening-start-innlesning:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
# SETTER IMAGE GHCR VARIABEL
- name: 'Setting Image ghcr Variabel'
run: echo "IMAGE_GHCR=ghcr.io/${{ github.repository }}/omsorgsopptjening-start-innlesning:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
# JAVA 21
- name: 'Java 21'
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 21
cache: 'gradle'
# BYGGER DOCKER CONTAINER
- name: 'Bygg og publiser docker image'
run: |
./gradlew clean build
docker build --tag ${{ env.IMAGE }} .
docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${{ secrets.GITHUB_TOKEN }}
docker push ${{ env.IMAGE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# UPLOAD FAILED TEST RESULTS
- name: 'Upload test results'
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-test-results
path: build/reports/tests/test
# DEPLOYER dev-gcp
- name: 'Deploy omsorgsopptjening-start-innlesning to dev-gcp'
uses: nais/deploy/actions/deploy@v2
env:
RESOURCE: nais/dev-gcp.yml,nais/unleash-apitoken-dev-gcp.yml
CLUSTER: dev-gcp
IMAGE: ${{ env.IMAGE_GHCR }}