Release #1
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: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., 0.9.0)' | |
| required: true | |
| next_dev_version: | |
| description: 'Next development version (e.g., 0.10.0-SNAPSHOT). Leave empty to auto-increment minor version.' | |
| required: false | |
| default: '' | |
| type: string | |
| skip_tests: | |
| description: 'Skip tests (use for hotfixes only)' | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Set version | |
| run: ./mvnw versions:set -DnewVersion=${{ inputs.version }} -DgenerateBackupPoms=false | |
| - name: Verify no SNAPSHOT dependencies | |
| run: | | |
| if grep -r "SNAPSHOT" --include="pom.xml" . | grep -v "<!--" | grep -v "target/"; then | |
| echo "ERROR: Found SNAPSHOT references in POM files" | |
| exit 1 | |
| fi | |
| echo "No SNAPSHOT dependencies found" | |
| - name: Build and verify | |
| run: | | |
| if [ "${{ inputs.skip_tests }}" = "true" ]; then | |
| ./mvnw clean verify -B -DskipTests | |
| else | |
| ./mvnw clean verify -B | |
| fi | |
| - name: Publish release to Maven Central | |
| run: ./mvnw deploy -B -DskipTests -Prelease | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Create Git tag | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git tag -a v${{ inputs.version }} -m "Release v${{ inputs.version }}" | |
| git push origin v${{ inputs.version }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ inputs.version }} | |
| name: Release ${{ inputs.version }} | |
| draft: false | |
| prerelease: ${{ contains(inputs.version, '-') }} | |
| generate_release_notes: true | |
| - name: Bump to next development version | |
| run: | | |
| if [ -n "${{ inputs.next_dev_version }}" ]; then | |
| NEXT_VERSION="${{ inputs.next_dev_version }}" | |
| else | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "${{ inputs.version }}" | |
| NEXT_VERSION="${MAJOR}.$((MINOR + 1)).0-SNAPSHOT" | |
| fi | |
| echo "Next development version: ${NEXT_VERSION}" | |
| ./mvnw versions:set -DnewVersion=${NEXT_VERSION} -DgenerateBackupPoms=false | |
| git add -A | |
| git commit -m "Bump version to ${NEXT_VERSION}" | |
| git push origin HEAD:main |