1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

add preview builds

This commit is contained in:
J3fftw1 2023-06-21 22:34:37 +02:00
parent 379cb97cf9
commit 72e249d542

64
.github/workflows/preview-builds.yml vendored Normal file
View File

@ -0,0 +1,64 @@
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 }}*