Merge pull request #15 from kang8/dev

fix PR bug and refactory publish snapshot
This commit is contained in:
yadong.zhang 2021-09-25 20:35:45 -05:00 committed by GitHub
commit 33145b7a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 14 deletions

View File

@ -4,32 +4,46 @@
name: Publish Snapshot
on:
workflow_dispatch:
push:
branches: [ dev ]
paths:
- src/**
- pom.xml
pull_request:
branches: [ dev ]
paths:
- src/**
- pom.xml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up Java and Maven
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Cache m2 package
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn test
publish:
needs: test
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up Apache Maven Central
uses: actions/setup-java@v1
- name: Set up Java and Maven
uses: actions/setup-java@v2
with:
java-version: 1.8
java-version: '8'
distribution: 'adopt'
server-id: sonatype-nexus-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
@ -52,7 +66,7 @@ jobs:
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
- name: deploy snapshot to oss repository
run: mvn clean deploy -P release
run: mvn -B deploy -P release -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

25
.github/workflows/test-pr.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: test pull_request
on:
pull_request:
paths:
- src/**
- pom.xml
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.2.0
- name: Set up Java and Maven
uses: actions/setup-java@v2
with:
java-version: '8'
- name: Cache m2 package
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: mvn test