提交 9ced5253 编写于 作者: 飞机飞过天空's avatar 飞机飞过天空

refactor: 重构流水线构建

上级 2de0ad50
name: Deploy SNAPSHOT name: Deploy snapshot for dev branch
on: on:
push: push:
...@@ -6,14 +6,29 @@ on: ...@@ -6,14 +6,29 @@ on:
paths: paths:
- src/** - src/**
- pom.xml - pom.xml
pull_request:
branches: [ dev ]
paths:
- src/**
- pom.xml
jobs: jobs:
get-latest-tag: 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
deploy-snapshot:
needs: test
if: ${{ success() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.2.0 - uses: actions/checkout@v2.2.0
...@@ -38,7 +53,7 @@ jobs: ...@@ -38,7 +53,7 @@ jobs:
if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }} if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }}
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
- name: deploy snapshot to ossrh repository - name: deploy snapshot to ossrh repository
run: mvn -B deploy -P snapshot run: mvn -B deploy -P snapshot -DskipTests
env: env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
name: test pull_request
on:
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册