This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
Bump org.springframework.boot:spring-boot-starter-parent from 2.7.17 to 2.7.18 #1614
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: Bygg og deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
IMAGE_BASE_GHCR: ghcr.io/${{ github.repository }}/vtp-pensjon | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# - name: Cache Docker layers | |
# uses: actions/cache@v3 | |
# with: | |
# path: /tmp/.buildx-cache | |
# key: ${{ runner.os }}-buildx-${{ github.sha }} | |
# restore-keys: | | |
# ${{ runner.os }}-buildx- | |
- uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: 'maven' | |
- name: Define version | |
shell: bash | |
run: | | |
TIME=$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M) | |
COMMIT=$(git rev-parse --short=12 HEAD) | |
export VERSION="$TIME-$COMMIT" | |
echo "Building version $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Build | |
shell: bash | |
run: | | |
export NODE_OPTIONS=--openssl-legacy-provider | |
mvn -T1C verify -Drevision="${VERSION}" -Dfile.encoding=UTF-8 -Dkotlin.format.skip=true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker image | |
env: | |
VERSION: ${{ env.VERSION }} | |
run: | | |
export DOCKER_BUILDKIT=1 | |
docker build --pull \ | |
--tag ${IMAGE_BASE_GHCR}:${VERSION} \ | |
--tag ${IMAGE_BASE_GHCR}:latest \ | |
. | |
- name: Log in to the Container registry | |
if: github.ref == 'refs/heads/main' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push Docker image | |
if: github.ref == 'refs/heads/main' | |
run: | | |
docker push ${IMAGE_BASE_GHCR}:latest | |
docker push ${IMAGE_BASE_GHCR}:${VERSION} | |
env: | |
VERSION: ${{ env.VERSION }} | |
- name: Deploy Maven Artifacts | |
if: github.ref == 'refs/heads/main' | |
shell: bash | |
run: | | |
export NODE_OPTIONS=--openssl-legacy-provider | |
mvn -T1C deploy -Drevision="${VERSION}" -Dfile.encoding=UTF-8 -Dkotlin.format.skip=true -Dkotlin.check.skip=true -DskipTests source:jar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |