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
76 changes: 34 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:

name: build java ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up java
uses: actions/setup-java@v3
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
java-version: ${{ matrix.java }}
distribution: temurin
Expand All @@ -23,49 +23,41 @@ jobs:
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml

makeversion:
if: github.ref != 'refs/heads/main'
publish:
needs: build
name: Publish ${{ github.ref_name }}
runs-on: ubuntu-latest
name: Create version
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Decide on build version
id: version
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Java
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # 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: |
if [[ $GITHUB_REF == *"tags"* ]]; then
TAG=${GITHUB_REF#refs/tags/}
profiles="build-sources-and-javadoc,deploy-to-maven-central"
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
profiles="$profiles,sign-artifacts"
version_suffix=""
else
TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT
version_suffix="-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@v4
- 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@v4
- name: Release to Central Repository
uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: true
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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target/*
.idea/*
*.iml
.vscode/settings.json
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>no.digipost</groupId>
<artifactId>digipost-open-super-pom</artifactId>
<version>6</version>
<version>14</version>
</parent>

<artifactId>digipost-html-validator</artifactId>
Expand Down Expand Up @@ -93,19 +93,19 @@
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.14.0</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<version>3.6.1</version>
<configuration>
<rules>
<requireMavenVersion>
Expand All @@ -122,38 +122,38 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.5.3</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.4</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<version>2.18.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.14.1</version>
<version>0.23.1</version>
<configuration>
<newVersion>
<file>
Expand Down