Skip to content

v0.2.12

v0.2.12 #15

Workflow file for this run

name: Gradle Publish
on:
release:
types: published
jobs:
# 校验tag是否满足语义化版本格式
check-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/[email protected]
# 发布项目
- name: Publish
run: ./gradlew publish
env:
SONATYPE_NEXUS_USERNAME: ${{secrets.SONATYPE_NEXUS_USERNAME}}
SONATYPE_NEXUS_PASSWORD: ${{secrets.SONATYPE_NEXUS_PASSWORD}}
SIGNING_KEY: ${{secrets.SIGNING_KEY}}
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}