Merge pull request #20 from digipost/oppgrader_pdfbox #29
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 and deploy | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8', '11' ] | |
name: build java ${{ matrix.java }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up java | |
uses: actions/[email protected] | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: temurin | |
cache: "maven" | |
- name: Build with Maven | |
run: mvn --settings .mvn/settings.xml -B verify -U --no-transfer-progress | |
makeversion: | |
if: github.ref != 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
name: Create version | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Decide on build version | |
id: version | |
run: | | |
if [[ $GITHUB_REF == *"tags"* ]]; then | |
TAG=${GITHUB_REF#refs/tags/} | |
else | |
TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT | |
fi | |
echo "version=${TAG//\//-}" >> $GITHUB_OUTPUT | |
deploy_snapshot: | |
if: startsWith(github.ref, 'refs/heads/') | |
needs: makeversion | |
runs-on: ubuntu-latest | |
name: Deploy snapshot | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: digipost/[email protected] | |
with: | |
sonatype_secrets: ${{ secrets.sonatype_secrets }} | |
release_version: ${{ needs.makeversion.outputs.version }} | |
perform_release: false | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: makeversion | |
name: Release to Sonatype | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v3 | |
- name: Release to Central Repository | |
uses: digipost/[email protected] | |
with: | |
sonatype_secrets: ${{ secrets.sonatype_secrets }} | |
release_version: ${{ needs.makeversion.outputs.version }} | |
perform_release: true |