- github 流水线调试v6 #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release to Maven Central | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| VERSION=${VERSION#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Update pom version | |
| run: mvn versions:set -DnewVersion=${{ steps.version.outputs.VERSION }} versions:commit | |
| - name: Import GPG private key | |
| run: | | |
| echo "${{ secrets.GPG_SECRET_KEY }}" | gpg --batch --import | |
| echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | |
| # 新的发布命令,用 Sonatype 新的插件 | |
| - name: Publish to Central | |
| run: mvn clean deploy -DskipTests -B | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.CENTRAL_USER }} | |
| MAVEN_PASSWORD: ${{ secrets.CENTRAL_PWD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |