forked from wechatpay-apiv3/wechatpay-apache-httpclient
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (41 loc) · 1.6 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Gradle Publish
on:
release:
types: published
jobs:
# 校验tag是否满足语义化版本格式
check-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Regex Match
id: regex-match
run: |
result=$(printf ${{github.ref_name}} | perl -ne 'printf if /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/')
echo "::set-output name=result::$result"
- name: Check Tag
if: ${{ steps.regex-match.outputs.result != github.ref_name }}
uses: actions/github-script@v4
with:
script: core.setFailed('Invalid Tag:${{github.ref_name}}')
# Push Tag时自动发布新版本到Maven中央仓库
publish:
needs: [check-tag]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
# 发布项目
- name: Publish
run: ./gradlew publish
env:
SONATYPE_NEXUS_USERNAME: ${{secrets.SONATYPE_NEXUS_USERNAME}}
SONATYPE_NEXUS_PASSWORD: ${{secrets.SONATYPE_NEXUS_PASSWORD}}
ORG_GRADLE_PROJECT_signingKey: ${{secrets.SIGNING_KEY}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.SIGNING_PASSWORD}}