Address PR review feedback (#8) #3
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 — GitHub Release + Maven Central | |
| # Trigger: push a version tag | |
| # git tag v1.0.0 && git push origin v1.0.0 | |
| # | |
| # Required repository secrets: | |
| # OSSRH_USERNAME — Sonatype Central Portal token username | |
| # OSSRH_PASSWORD — Sonatype Central Portal token password | |
| # GPG_PRIVATE_KEY — gpg --export-secret-keys --armor <key-id> | |
| # GPG_PASSPHRASE — passphrase for the GPG key above | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to release (e.g. 1.0.0) — without the 'v' prefix" | |
| required: true | |
| jobs: | |
| release: | |
| name: Build and Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: corretto | |
| cache: maven | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Releasing version: $VERSION" | |
| - name: Set Maven version | |
| run: | | |
| mvn --batch-mode versions:set \ | |
| -DnewVersion=${{ steps.version.outputs.version }} \ | |
| -DgenerateBackupPoms=false | |
| - name: Import GPG key | |
| run: echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import | |
| - name: Build, sign and publish to Maven Central | |
| run: mvn --batch-mode clean deploy -Prelease --settings .github/settings.xml | |
| env: | |
| OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| make_latest: true | |
| files: | | |
| target/json2jsontransformer-*.jar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |