publish #290
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: publish | |
| on: | |
| workflow_dispatch: {} | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| server-id: ossrh | |
| settings-path: ${{ github.workspace }} | |
| server-username: SONATYPE_USERNAME | |
| server-password: SONATYPE_PASSWORD | |
| gpg-private-key: ${{ secrets.OSSRH_SIGNING_KEY }} | |
| gpg-passphrase: SONATYPE_SIGNING_PASSWORD | |
| - name: configure-git-user | |
| run: | | |
| git config user.email "team@moderne.io" | |
| git config user.name "team-moderne[bot]" | |
| - name: bump-rewrite-properties-to-releases | |
| run: | | |
| ./mvnw versions:update-properties -DincludeProperties=rewrite.version,rewrite-polyglot.version -DallowDowngrade=true | |
| git diff-index --quiet HEAD pom.xml || git commit -m "Bump rewrite.version property" pom.xml && rm -f pom.xml.versionsBackup | |
| - name: publish-release | |
| run: ./mvnw --show-version --settings=${{ github.workspace }}/settings.xml --file=pom.xml --activate-profiles=sign-artifacts,release,release-automation help:active-profiles release:prepare release:perform --batch-mode -Dstyle.color=always | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN }} | |
| SONATYPE_SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }} | |
| - name: github-release | |
| if: ${{ success() }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| export tag=$(git describe --tags --abbrev=0) | |
| gh release create "$tag" \ | |
| --repo="$GITHUB_REPOSITORY" \ | |
| --title="${tag#v}" \ | |
| --generate-notes | |
| - name: rollback | |
| if: ${{ failure() }} | |
| run: ./mvnw --show-version --settings=${{github.workspace}}/settings.xml --file=pom.xml --activate-profiles=sign-artifacts,release,release-automation help:active-profiles release:rollback --batch-mode -Dstyle.color=always | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: bump-rewrite-properties-to-snapshots | |
| run: | | |
| ./mvnw versions:update-properties -DincludeProperties=rewrite.version,rewrite-polyglot.version -DallowSnapshots=true | |
| git diff-index --quiet HEAD pom.xml || (git commit -m "Bump rewrite.version property" pom.xml && git push origin main && rm -f pom.xml.versionsBackup) |