Skip to content

Commit

Permalink
Add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
runeflobakk committed Sep 2, 2024
1 parent 665185f commit 7592538
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and deploy
on: [push]


jobs:
build:
strategy:
matrix:
java: [ '11', '21' ]
name: Build on Java ${{ matrix.java }}
runs-on: ubuntu-latest
env:
MAVEN_ARGS: --show-version --no-transfer-progress
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: "maven"
- name: Build with Maven
run: mvn verify


publishing_parameters:
name: Publishing parameters
runs-on: ubuntu-latest
outputs:
is_release: ${{ steps.version.outputs.is_release }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Determine version
id: version
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
is_release=true
version=${GITHUB_REF#refs/tags/}
else
is_release=false
version=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
echo "is_release=${is_release//\//-}" >> $GITHUB_OUTPUT
echo "version=${version//\//-}" >> $GITHUB_OUTPUT
publish:
needs: [ build, publishing_parameters ]
name: Publish ${{ needs.publishing_parameters.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: digipost/action-maven-publish@v1
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.publishing_parameters.outputs.version }}
perform_release: ${{ needs.publishing_parameters.outputs.is_release }}

0 comments on commit 7592538

Please sign in to comment.