Revert. Just preserve static ctors. Too complicated right now. #33
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: java-ref-plugin | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| release: | |
| types: | |
| - created | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| outputs: | |
| gradle_version: ${{ steps.maven_version.outputs.value }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v4 | |
| with: | |
| versionSpec: 6.x | |
| - name: Execute GitVersion | |
| id: gitversion | |
| uses: gittools/actions/gitversion/execute@v4 | |
| - name: Compute Maven-friendly version | |
| id: maven_version | |
| shell: bash | |
| env: | |
| GITVERSION_MAJOR_MINOR_PATCH: ${{ steps.gitversion.outputs.majorMinorPatch }} | |
| GITVERSION_PRE_RELEASE_LABEL: ${{ steps.gitversion.outputs.preReleaseLabel }} | |
| GITVERSION_PRE_RELEASE_NUMBER: ${{ steps.gitversion.outputs.preReleaseNumber }} | |
| run: | | |
| version="$GITVERSION_MAJOR_MINOR_PATCH" | |
| if [ -n "$GITVERSION_PRE_RELEASE_LABEL" ]; then | |
| version="$version-$GITVERSION_PRE_RELEASE_LABEL" | |
| if [ -n "$GITVERSION_PRE_RELEASE_NUMBER" ]; then | |
| version="$version-$GITVERSION_PRE_RELEASE_NUMBER" | |
| fi | |
| fi | |
| echo "Computed Maven version: $version" | |
| echo "value=$version" >> "$GITHUB_OUTPUT" | |
| - name: Set up Java 8 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 8 | |
| - name: Set up Java 25 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Build and test | |
| env: | |
| ORG_GRADLE_PROJECT_version: ${{ steps.maven_version.outputs.value }} | |
| run: ./gradlew build | |
| - name: Upload library JAR | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: java-ref-plugin-${{ steps.maven_version.outputs.value }} | |
| path: build/libs/java-ref-plugin-${{ steps.maven_version.outputs.value }}.jar | |
| if-no-files-found: error | |
| - name: Upload sources JAR | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: java-ref-plugin-${{ steps.maven_version.outputs.value }}-sources | |
| path: build/libs/java-ref-plugin-${{ steps.maven_version.outputs.value }}-sources.jar | |
| if-no-files-found: error | |
| - name: Upload Gradle build output | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: gradle-build-output | |
| path: build/ | |
| if-no-files-found: error | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 25 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Download Gradle build output | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: gradle-build-output | |
| path: build/ | |
| - name: Verify restored Gradle build output | |
| env: | |
| ORG_GRADLE_PROJECT_version: ${{ needs.build.outputs.gradle_version }} | |
| run: | | |
| find build -maxdepth 3 -type f | sort | |
| test -d build/libs | |
| test -f "build/libs/java-ref-plugin-${ORG_GRADLE_PROJECT_version}.jar" | |
| test -f "build/libs/java-ref-plugin-${ORG_GRADLE_PROJECT_version}-sources.jar" | |
| - name: Publish release to GitHub Packages | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| ORG_GRADLE_PROJECT_version: ${{ needs.build.outputs.gradle_version }} | |
| run: > | |
| ./gradlew publish | |
| -x compileJava | |
| -x compileTestJava | |
| -x processResources | |
| -x processTestResources | |
| -x classes | |
| -x testClasses | |
| -x jar | |
| -x sourcesJar | |
| -x test |