Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 38 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,41 @@ jobs:
- 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/action-maven-publish@1.3.2
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/action-maven-publish@1.3.2
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: true
publish:
needs: build
name: Publish ${{ github.ref_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Set up Java
uses: actions/setup-java@v4.7.1
with:
distribution: temurin
java-version: '21'
cache: "maven"
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PRIVATE }}
server-id: central
server-username: MAVEN_CENTRAL_TOKEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Activate Artifact Signing and Version Suffix
run: |
profiles="build-sources-and-javadoc,deploy-to-maven-central"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
profiles="$profiles,sign-artifacts"
version_suffix=""
else
version_suffix="-SNAPSHOT"
fi
echo "MAVEN_PROFILES=$profiles" >> $GITHUB_ENV
version="${GITHUB_REF_NAME}${version_suffix}"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Set Maven version
run: mvn --batch-mode --no-transfer-progress versions:set -DnewVersion=${VERSION}
- name: Build and deploy to Maven Central
run: |
mvn --batch-mode --no-transfer-progress --activate-profiles ${MAVEN_PROFILES} deploy
env:
MAVEN_CENTRAL_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
MAVEN_CENTRAL_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSPHRASE }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>no.digipost</groupId>
<artifactId>digipost-open-super-pom</artifactId>
<version>13</version>
<version>14</version>
</parent>

<artifactId>printability-validator</artifactId>
Expand Down