MetaObjects 6.3.0 - Revolutionary Fluent Constraint System #11
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 to Maven Central | |
| on: | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: write # Required for git push back to repository | |
| actions: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for merging | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Merge develop to master | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| # Ensure we're on master branch | |
| git checkout master | |
| git pull origin master | |
| # Fetch and merge develop | |
| git fetch origin develop | |
| git merge origin/develop --no-ff -m "Release: Merge develop for version ${{ github.event.release.tag_name }}" | |
| # Push the merge to master | |
| git push origin master | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: GPG_PASSPHRASE | |
| - name: Set Release Version | |
| run: | | |
| VERSION=${{ github.event.release.tag_name }} | |
| VERSION=${VERSION#v} # Remove 'v' prefix if present | |
| mvn versions:set -DnewVersion=${VERSION} -DgenerateBackupPoms=false | |
| - name: Publish to Central | |
| run: mvn clean deploy -P release -DskipTests | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Update to Next Snapshot | |
| run: | | |
| # Get current version and increment patch version with SNAPSHOT | |
| CURRENT_VERSION=${{ github.event.release.tag_name }} | |
| CURRENT_VERSION=${CURRENT_VERSION#v} # Remove 'v' prefix if present | |
| # Extract major.minor.patch and increment patch | |
| MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1) | |
| MINOR=$(echo $CURRENT_VERSION | cut -d. -f2) | |
| PATCH=$(echo $CURRENT_VERSION | cut -d. -f3) | |
| NEXT_PATCH=$((PATCH + 1)) | |
| NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT" | |
| mvn versions:set -DnewVersion=${NEXT_VERSION} -DgenerateBackupPoms=false | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add pom.xml */pom.xml | |
| git commit -m "Prepare next development iteration [skip ci]" | |
| # Push to both master and develop branches | |
| git push origin master | |
| # Also update develop branch with new snapshot version | |
| git fetch origin develop | |
| git checkout develop | |
| git merge master --strategy-option=theirs | |
| git push origin develop | |