chore: bump Java and JS versions to 2.5.0 #58
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 Deploy Java Parser | |
| on: | |
| push: | |
| branches: [develop, main] | |
| tags: ['v*'] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Configure GPG for batch mode | |
| run: | | |
| echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | |
| echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf | |
| gpgconf --kill gpg-agent | |
| - name: Verify GPG key | |
| run: | | |
| gpg --list-secret-keys | |
| echo "Testing GPG signing..." | |
| echo "test" | gpg --batch --pinentry-mode loopback --passphrase "$MAVEN_GPG_PASSPHRASE" --clearsign > /dev/null && echo "GPG signing works!" | |
| env: | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Install ANTLR4 | |
| run: make dev | |
| - name: Set SNAPSHOT version (develop branch) | |
| if: github.ref == 'refs/heads/develop' | |
| run: | | |
| cd java | |
| BASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//') | |
| mvn versions:set -DnewVersion="${BASE_VERSION}-SNAPSHOT" -DgenerateBackupPoms=false | |
| - name: Set release version (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| cd java | |
| BASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//') | |
| mvn versions:set -DnewVersion="${BASE_VERSION}" -DgenerateBackupPoms=false | |
| - name: Set release version (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cd java | |
| TAG_VERSION=${GITHUB_REF_NAME#v} | |
| mvn versions:set -DnewVersion="${TAG_VERSION}" -DgenerateBackupPoms=false | |
| - name: Generate and Compile Java Code | |
| run: make java_parser | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Deploy SNAPSHOT to Sonatype Snapshots | |
| if: github.ref == 'refs/heads/develop' | |
| run: cd java && mvn clean deploy -DskipCentralPublishing=true | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Deploy Release to Central Portal | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
| run: cd java && mvn clean deploy | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |