From 2474a57fba23964e92fc012f715c218f0a0db640 Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Mon, 3 Jun 2024 19:32:33 +0800 Subject: [PATCH] workflow: rewrite workflow to auto release to modrinth --- .editorconfig | 4 ++++ .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 21 --------------------- .github/workflows/release.yaml | 31 +++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yaml diff --git a/.editorconfig b/.editorconfig index 4231567..aea3f58 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,7 @@ max_line_length = 120 [{*.json,pack.mcmeta}] insert_final_newline = false + +[*.yaml] +indent_size = 2 +indent_style = space diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..eb6d086 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Build + +on: + pull_request: + branches: + - neoforge + push: + branches: + - neoforge + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build with Gradle + run: ./gradlew build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + path: build/libs/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 1fb4826..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup JDK 21 - uses: actions/setup-java@v4 - with: - java-version: '21' - distribution: 'temurin' - - - name: Build with Gradle - uses: gradle/actions/setup-gradle@v3 - with: - arguments: build diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4e13d5b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + tags: + - 'neoforge@*' + +jobs: + release: + runs-on: ubuntu-latest + environment: release + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build with Gradle + run: ./gradlew build + + - name: Upload to modrinth with Gradle + run: ./gradlew modrinth + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}