Skip to content

Merge pull request #405 from kaituo/missing #23

Merge pull request #405 from kaituo/missing

Merge pull request #405 from kaituo/missing #23

name: Build and publish snapshot on push to main
on:
push:
branches:
- main
defaults:
run:
working-directory: Java/
jobs:
build:
name: Build project and publish SNAPSHOT
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v1
- name: Set up java for publishing snapshot
uses: actions/setup-java@v1
with:
java-version: 17
server-id: ossrh-snapshot
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Extract project version
id: project
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Publish to snapshot repo
if: ${{ endsWith(steps.project.outputs.version, '-SNAPSHOT') }}
run: mvn -B deploy --file pom.xml -Pgpg-sign
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}