name: Preview builds on: push: branches-ignore: - master pull_request: paths: - 'src/**' - 'pom.xml' permissions: pull-requests: write contents: read jobs: preview: if: ${{ github.repository_owner == 'Slimefun' }} name: Build and Publish the jar runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Set up JDK 17 uses: actions/setup-java@v3.11.0 with: distribution: 'adopt' java-version: '17' java-package: jdk architecture: x64 - name: Cache Maven packages uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Build with Maven run: mvn package - name: Upload to preview service run: | curl -X POST \ -H 'Authorization: ${{ secrets.PUBLISH_TOKEN }}' \ -H "X-Checksum: $(sha256sum 'target/Slimefun v4.9-UNOFFICIAL.jar')" \ --data-binary '@target/Slimefun v4.9-UNOFFICIAL.jar' \ https://preview-builds.walshy.dev/upload/Slimefun/${{ github.event.number }}/${{ github.run.number }} - name: Post comment uses: marocchino/sticky-pull-request-comment@v2 with: message: | #### Slimefun preview jar This is the preview jar for this Pull Request. This can be used for reviewers to test this PR. https://preview-builds.walshy.dev/download/Slimefun/${{ github.event.number }}/${{ github.run.number }} *Pusher: @${{ github.actor }}, Action: ${{ github.event_name }}*