Fix toJson classloader bridge and ASM defaults (#52) #92
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 Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-java: | |
| name: Build Java | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '8' | |
| distribution: 'adopt' | |
| - name: Build Java with Maven | |
| run: | | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| mvn package | |
| cp "target/swapper-${VERSION}.jar" swapper.jar | |
| shell: bash | |
| - name: Upload Jar | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts | |
| path: swapper.jar | |
| # test-download: | |
| # needs: ["build-java"] | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: download | |
| # uses: actions/download-artifact@v4 | |
| # - name: tree | |
| # run: | | |
| # tree . | |
| # tree artifacts | |
| release: | |
| needs: ["build-java"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '8' | |
| distribution: 'adopt' | |
| - name: Check Version Change | |
| id: version | |
| run: | | |
| CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| PREVIOUS_VERSION="" | |
| BEFORE_SHA="${{ github.event.before }}" | |
| if [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ] && git show "${BEFORE_SHA}:pom.xml" > previous-pom.xml 2>/dev/null; then | |
| PREVIOUS_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -f previous-pom.xml) | |
| fi | |
| echo "current=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "previous=${PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT" | |
| if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| shell: bash | |
| - name: Check Release Exists | |
| if: steps.version.outputs.changed == 'true' | |
| id: release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if gh release view "v${{ steps.version.outputs.current }}" > /dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| shell: bash | |
| - name: Download Artifacts | |
| if: steps.version.outputs.changed == 'true' && steps.release.outputs.exists == 'false' | |
| uses: actions/download-artifact@v4 | |
| - name: tree | |
| if: steps.version.outputs.changed == 'true' && steps.release.outputs.exists == 'false' | |
| run: | | |
| tree artifacts | |
| - name: Upload Release Assets | |
| if: steps.version.outputs.changed == 'true' && steps.release.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.current }} | |
| name: Release v${{ steps.version.outputs.current }} | |
| files: artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |