修复central-publishing-maven-plugin (#108) #100
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '*.md' | |
| - 'docs/**' | |
| - 'executors/**' | |
| workflow_dispatch: | |
| inputs: | |
| releaseVersion: | |
| description: "Define the release version" | |
| required: true | |
| default: "" | |
| developmentVersion: | |
| description: "Define the snapshot version" | |
| required: true | |
| default: "" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 拉取源码 | |
| - uses: actions/checkout@v3 | |
| with: | |
| token: ${{secrets.RELEASE_TOKEN}} | |
| - name: Set up Apache Maven Central | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| server-id: central | |
| cache: 'maven' | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_CENTRAL_TOKEN | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| - name: Configure Git User | |
| run: | | |
| git config user.email "actions@github.com" | |
| git config user.name "GitHub Actions" | |
| - name: Verify Whether a Release is Ready | |
| id: release | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event.inputs.releaseVersion }}" != "" ] && [ "${{ github.event.inputs.developmentVersion }}" != "" ]; then | |
| echo "auto_release=true" >> $GITHUB_ENV | |
| else | |
| echo "auto_release=false" >> $GITHUB_ENV | |
| fi | |
| - name: Deploy to maven central | |
| run: | | |
| mvn -P release -B clean \ | |
| deploy \ | |
| -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| if: env.auto_release != 'true' | |
| - name: Perform maven release | |
| run: | | |
| mvn -P release -B clean \ | |
| release:prepare release:perform \ | |
| -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }} \ | |
| -DreleaseVersion=${{ github.event.inputs.releaseVersion }} \ | |
| -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} \ | |
| -DscmCommentPrefix="[skip ci]" | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| AUTO_RELEASE_AFTER_CLOSE: true | |
| if: env.auto_release == 'true' | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push to DockerHub | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| context: . | |
| file: ./docker/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ github.event.inputs.releaseVersion != '' && format('weibocom/rill-flow:latest,weibocom/rill-flow:{0}',github.event.inputs.releaseVersion) || 'weibocom/rill-flow:latest' }} |