From b80827baac9e85b4ee79092fcccd1d228ccd813f Mon Sep 17 00:00:00 2001 From: SettingDust Date: Mon, 18 Nov 2024 23:44:02 +0800 Subject: [PATCH] ci: add publish --- .github/dependabot.yml | 11 ++++ .github/workflows/build.yml | 25 ++++++++ .github/workflows/dependency-submission.yml | 21 +++++++ .github/workflows/publish.yml | 70 +++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/dependency-submission.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c47f7f4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: gradle # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: weekly diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ca7fb95 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +on: + push: +jobs: + build: + name: Dependencies + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: gradle + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-read-only: false + + - name: Execute Gradle build + run: ./gradlew build diff --git a/.github/workflows/dependency-submission.yml b/.github/workflows/dependency-submission.yml new file mode 100644 index 0000000..a178b95 --- /dev/null +++ b/.github/workflows/dependency-submission.yml @@ -0,0 +1,21 @@ +name: Dependency Submission + +on: + push: + branches: [ 'main' ] + +permissions: + contents: write + +jobs: + dependency-submission: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a4ea170 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,70 @@ +on: + push: + tags: [ '[0-9]+.[0-9]+.[0-9]+' ] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: 'gradle' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-read-only: false + + - name: Execute Gradle build + run: ./gradlew build + + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ github.token }} + tag: ${{ github.ref_name }} + + - name: Upload jar + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + changelog: ${{ steps.changelog.outputs.changes }} + # Only include this section if you wish to publish + # your assets on Modrinth. + modrinth-id: item-converter + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + # Only include this section if you wish to publish + # your assets on CurseForge. + curseforge-id: 1143473 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + + files: | + build/libs/!(*-@(fabric|sources|dev)).jar + build/libs/*-@(sources).jar + + version: ${{ github.ref_name }} + + loaders: | + forge + + game-versions: | + 1.19.2 + game-version-filter: releases + + dependencies: | + kotlin-for-forge + + java: | + 17 + + - name: Commit CHANGELOG.md + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: main + commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' + file_pattern: CHANGELOG.md