Run workflows on any major version branch (#614) #110
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: Test and Deploy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- [0-9]+.[0-9]+ | ||
jobs: | ||
test: | ||
name: Java ${{ matrix.java }} Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: [ 8, 11, 17 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- run: | | ||
./mvnw clean install -DskipTests -B | ||
./mvnw verify -B | ||
deploy: | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml | ||
server-username: MAVEN_USERNAME # env variable for username in deploy | ||
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy | ||
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase | ||
- name: Publish to Apache Maven Central | ||
run: ./mvnw clean deploy -Drelease -DskipTests -B | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||