create actionCmd just once (#317) #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 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'oracle' | |
cache: 'maven' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_CENTRAL_TOKEN | |
- name: Build project | |
run: | | |
export DISPLAY=:90 | |
Xvfb -ac :90 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
mvn -B -ntp verify -f rta | |
- name: Publish Snapshots | |
if: github.ref == 'refs/heads/main' | |
run: | | |
ver=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -f rta) | |
if [[ $ver == *"SNAPSHOT"* ]]; then | |
mvn -B -ntp -Dmaven.test.skip=true deploy -f rta | |
fi | |
shell: bash | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} |