Skip to content

chore(deps): update dependency org.apache.maven.plugins:maven-surefir… #62

chore(deps): update dependency org.apache.maven.plugins:maven-surefir…

chore(deps): update dependency org.apache.maven.plugins:maven-surefir… #62

Workflow file for this run

name: java-release-main
on:
push:
branches:
- main
paths:
- pom.xml
- .github/workflows/release.yml
jobs:
publish:
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@v4
- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: "temurin"
java-version: "17"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.SONATYPE_OSSRH_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Install jq
run: |
curl http://stedolan.github.io/jq/download/linux64/jq -o ./jq
chmod a+x ./jq
- name: Detect version change
id: detect
run: |
CENTRAL_VERSION=$(curl -H "Accept: application/json" -L "https://central.sonatype.com/solrsearch/select?q=g:com.cognite.units+a:units-catalog&rows=1&wt=json" | jq -r '.response.docs[0].latestVersion')
MVN_VERSION=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.version}' \
--non-recursive \
exec:exec)
echo "CENTRAL_VERSION=$CENTRAL_VERSION"
echo "MVN_VERSION=$MVN_VERSION"
echo "central_version=$CENTRAL_VERSION" >> $GITHUB_OUTPUT
echo "maven_version=$MVN_VERSION" >> $GITHUB_OUTPUT
- name: Publish to Apache Maven Central
if: ${{ !endsWith(steps.detect.outputs.maven_version, 'SNAPSHOT') && steps.detect.outputs.maven_version != steps.detect.outputs.central_version }}
run: |
mvn -B clean deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_OSSRH_USER }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.SONATYPE_OSSRH_GPG_KEY_PASSPHRASE }}