From a828ab019410fab5d4726e774db97a30b87775b2 Mon Sep 17 00:00:00 2001 From: Etil <81570777+etil2jz@users.noreply.github.com> Date: Fri, 17 Sep 2021 21:34:08 +0200 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..35aa13f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build +on: [ push, pull_request ] +jobs: + build: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + runs-on: ubuntu-latest + strategy: + matrix: + java: [ 16 ] + fail-fast: true + steps: + - name: Checkout Git Repository + uses: actions/checkout@v2 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: ${{ matrix.java }} + distribution: 'adopt' + - name: Pull Gradle Cache + uses: actions/cache@v2 + id: gradle-cache + with: + path: ~/.gradle + key: ${{ runner.os }}-maven-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-java-${{ matrix.java }} + - name: Configure Git + run: | + git config --global user.email "no-reply@github.com" + git config --global user.name "Github Actions" + - name: Patch + run: | + ./gradlew clean applyPatches --stacktrace --no-daemon + - name: Get MC Version + run: echo "::set-output name=mcver::$(grep mcVersion gradle.properties | awk '{print $3;}')" + id: mcver + - name: Build + run: | + ./gradlew paperclipJar --stacktrace --no-daemon + - name: Archive Paperclip + uses: actions/upload-artifact@v2 + with: + name: Mirai Paperclip + path: build/libs/Mirai-${{ steps.mcver.outputs.mcver }}-R0.1-SNAPSHOT.jar + - name: Prepare Github Page Files + run: | + mkdir -p public + cp build/libs/Mirai-${{ steps.mcver.outputs.mcver }}-R0.1-SNAPSHOT.jar public/ + - name: Deploy to Github Pages + if: github.event_name != 'pull_request' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + publish_branch: release/1.17