mirror of
https://gitee.com/yadong.zhang/JustAuth.git
synced 2025-12-08 01:38:24 +08:00
commit
62cd7af619
47
.github/workflows/deploy-snapshot.yml
vendored
47
.github/workflows/deploy-snapshot.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Deploy SNAPSHOT
|
name: Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -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
|
||||||
@ -32,13 +47,19 @@ jobs:
|
|||||||
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
|
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-maven-
|
${{ runner.os }}-maven-
|
||||||
- name: get current project version to set env.VERSION
|
- name: setting snapshot version
|
||||||
run: echo "VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`" >> $GITHUB_ENV
|
run: |
|
||||||
- name: set snapshot version
|
import xml.etree.ElementTree as ET
|
||||||
if: ${{ !endsWith( env.VERSION , '-SNAPSHOT') }}
|
tree = ET.parse("pom.xml")
|
||||||
run: mvn versions:set -DnewVersion=${{ env.VERSION }}-SNAPSHOT
|
version = tree.find("{http://maven.apache.org/POM/4.0.0}version")
|
||||||
|
print(version.text + "-SNAPSHOT")
|
||||||
|
if version.text.endswith("-SNAPSHOT") == False:
|
||||||
|
tree.find("{http://maven.apache.org/POM/4.0.0}version").text = version.text + "-SNAPSHOT"
|
||||||
|
ET.register_namespace("", "http://maven.apache.org/POM/4.0.0")
|
||||||
|
tree.write("pom.xml", "utf-8", True)
|
||||||
|
shell: python
|
||||||
- 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 }}
|
||||||
|
|||||||
26
.github/workflows/test-pr.yml
vendored
Normal file
26
.github/workflows/test-pr.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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'
|
||||||
|
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
|
||||||
Loading…
x
Reference in New Issue
Block a user