chore(): Paper 1.21 has minimum java version 21 #13
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: Build and Publish to GitHub Maven | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| cache: maven | |
| - name: Extract version from pom.xml | |
| id: extract_version | |
| shell: bash | |
| run: | | |
| BASE_VERSION=$(mvn -q -Dexec.cleanupDaemonThreads=false help:evaluate -Dexpression=project.version -DforceStdout) | |
| echo "BASE_VERSION=$BASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Validate SemVer version | |
| id: validate_semver | |
| shell: bash | |
| run: | | |
| VERSION='${{ steps.extract_version.outputs.BASE_VERSION }}' | |
| echo "Detected project version: $VERSION" | |
| if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z\.-]+)?(\+[0-9A-Za-z\.-]+)?$ ]]; then | |
| echo "Error: Version in pom.xml ('$VERSION') is not SemVer (expected MAJOR.MINOR.PATCH)." >&2 | |
| echo "Please update <version> in pom.xml to a valid SemVer (e.g., 4.0.0 or 4.0.1-rc.1)." >&2 | |
| exit 1 | |
| fi | |
| echo "NEW_VERSION=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Build with Maven | |
| run: mvn -B clean install | |
| - name: Ensure tag does not already exist | |
| shell: bash | |
| run: | | |
| NEW_VERSION='${{ steps.validate_semver.outputs.NEW_VERSION }}' | |
| git fetch --tags --quiet | |
| if git rev-parse -q --verify "refs/tags/${NEW_VERSION}" >/dev/null; then | |
| echo "Tag ${NEW_VERSION} already exists. Please bump the version in pom.xml." >&2 | |
| exit 1 | |
| fi | |
| - name: Create and push tag | |
| shell: bash | |
| run: | | |
| NEW_VERSION='${{ steps.validate_semver.outputs.NEW_VERSION }}' | |
| echo "Tagging release ${NEW_VERSION}" | |
| git tag "${NEW_VERSION}" | |
| git push origin "${NEW_VERSION}" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Maven settings | |
| run: | | |
| mkdir -p "$HOME/.m2" | |
| cat > "$HOME/.m2/settings.xml" <<'EOF' | |
| <settings> | |
| <servers> | |
| <server> | |
| <id>github</id> | |
| <username>${env.GITHUB_ACTOR}</username> | |
| <password>${env.GITHUB_TOKEN}</password> | |
| </server> | |
| </servers> | |
| </settings> | |
| EOF | |
| shell: bash | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to GitHub Packages | |
| run: mvn -B deploy -DskipTests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |