Skip to content

publish

publish #151

Workflow file for this run

---
name: publish
on:
workflow_dispatch: {}
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
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 "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: bump-rewrite-properties-to-releases
run: |
./mvnw versions:update-properties -DincludeProperties=rewrite.version,rewrite.python.version,rewrite.kotlin.version -DallowDowngrade=true
git diff-index --quiet HEAD pom.xml || git commit -m "Bump rewrite.version properties" 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.OSSRH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
SONATYPE_SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
- 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.python.version,rewrite.kotlin.version -DallowSnapshots=true
git diff-index --quiet HEAD pom.xml || git commit -m "Bump rewrite.version properties" pom.xml && git push origin main && rm -f pom.xml.versionsBackup