build and publish parent as part of required project (#35) #94
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 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java and Apache Maven | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_CENTRAL_TOKEN | |
- name: Build Project | |
run: mvn -B -ntp clean verify | |
- name: Publish Snapshots | |
if: github.ref == 'refs/heads/main' | |
run: | | |
# Find version | |
ver=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
if [[ $ver == *"SNAPSHOT"* ]] | |
then | |
mvn -B -ntp clean deploy -pl 'emoji, offline' -am | |
fi | |
shell: bash | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} |