NAV-23617: Fikser SerDes for KS-søknad (#977) #1060
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: Build-Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy-artifact: | |
name: Build and deploy to github package | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
id: setup-java | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: Resolve/Update Dependencies | |
env: | |
GITHUB_USERNAME: x-access-token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn package dependency:resolve-plugins dependency:go-offline | |
- name: Build (and run tests) | |
if: steps.setup-java.outputs.cache-hit != 'true' | |
run: mvn clean install | |
- name: Setting version | |
run: | | |
export GIT_COMMIT_HASH=$(git log -n 1 --pretty=format:'%h') | |
export GIT_COMMIT_DATE=$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S') | |
export VERSION=3.0_${GIT_COMMIT_DATE}_${GIT_COMMIT_HASH} | |
echo "Setting version $VERSION" | |
mvn versions:set -DnewVersion="$VERSION" | |
mvn versions:commit | |
- name: Deploy to Github Package | |
env: | |
GITHUB_USERNAME: x-access-token | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn --settings .github/maven-settings.xml source:jar-no-fork deploy -DskipTests=true -Dmaven.wagon.http.pool=false |