Add support for REST API v0.7 #57
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 test | |
| on: | |
| # Build PRs and branches. | |
| pull_request_target: | |
| types: [ opened, synchronize, reopened ] | |
| paths-ignore: | |
| - .github/workflows/deploy-tagged.yml | |
| push: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '**' | |
| paths-ignore: | |
| - .github/workflows/deploy-tagged.yml | |
| jobs: | |
| build: | |
| name: jdk ${{ matrix.java }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # https://en.wikipedia.org/wiki/Java_version_history | |
| java: [ '8', '11' ] # LTS | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Setup JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| # The Gradle wrapper's version (already the default, putting it here to clarity) | |
| gradle-version: wrapper | |
| # Removing unused files from Gradle User Home before saving to cache (i.e. older versions of gradle) | |
| gradle-home-cache-cleanup: true | |
| # Cache downloaded JDKs in addition to the default directories. | |
| gradle-home-cache-includes: | | |
| caches | |
| notifications | |
| jdks | |
| - name: Build and test | |
| env: | |
| UPLOADCARE_PUBLIC_KEY: ${{ secrets.UPLOADCARE_PUBLIC_KEY }} | |
| UPLOADCARE_SECRET_KEY: ${{ secrets.UPLOADCARE_SECRET_KEY }} | |
| run: ./gradlew build --stacktrace | |
| publish-snapshot: | |
| name: Publish snapshot to GitHub Packages | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master') | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Get base version | |
| id: get-version | |
| run: | | |
| BASE_VERSION=$(grep -iE "version([ ]*)=" gradle.properties | cut -f 2 -d "=" | tr -d '[:space:]') | |
| # Strip any existing -SNAPSHOT suffix so we can re-apply it cleanly | |
| BASE_VERSION="${BASE_VERSION%-SNAPSHOT}" | |
| echo "base_version=${BASE_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Determine snapshot version | |
| id: snapshot-version | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request_target" ]; then | |
| SNAPSHOT_VERSION="${{ steps.get-version.outputs.base_version }}-PR-${{ github.event.pull_request.number }}-SNAPSHOT" | |
| else | |
| SNAPSHOT_VERSION="${{ steps.get-version.outputs.base_version }}-SNAPSHOT" | |
| fi | |
| echo "snapshot_version=${SNAPSHOT_VERSION}" >> $GITHUB_OUTPUT | |
| echo "Publishing snapshot version: ${SNAPSHOT_VERSION}" | |
| - name: Setup JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 8 | |
| distribution: 'temurin' | |
| - name: Setup Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| gradle-version: wrapper | |
| gradle-home-cache-cleanup: true | |
| gradle-home-cache-includes: | | |
| caches | |
| notifications | |
| jdks | |
| - name: Publish snapshot to GitHub Packages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| run: ./gradlew publishReleasePublicationToGitHubPackagesRepository -Pversion=${{ steps.snapshot-version.outputs.snapshot_version }} --stacktrace |