From ba3c6b723b388182bc956168d8c9f49f05ae8217 Mon Sep 17 00:00:00 2001 From: LLytho <29131229+LLytho@users.noreply.github.com> Date: Sun, 21 Aug 2022 13:41:39 +0200 Subject: [PATCH] Add github ci --- .github/stale.yml | 12 ++++ .github/workflows/build.yml | 44 +++++++++++++ .github/workflows/release.yml | 120 ++++++++++++++++++++++++++++++++++ .github/workflows/support.yml | 9 +++ Fabric/build.gradle.kts | 2 +- Forge/build.gradle.kts | 2 +- gradle.properties | 2 +- 7 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 .github/stale.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/support.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..779f91c --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,12 @@ +daysUntilStale: 14 +daysUntilClose: 3 +exemptLabels: + - "state: completed" + - "state: confirmed" + - "state: help wanted/needed" + - "state: in progress" +staleLabel: "type: abandoned" +markComment: > + This submission has been automatically marked as abandoned because it has not had recent activity. It will be closed in 3 days. If you want to prevent that, leave a new comment. +closeComment: > + Due to no recent activity, this submission is closed now. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f3e8a0a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: + - '1.18' + tags-ignore: + - '**' + pull_request: + branches: + - '1.18' + +env: + JAVA_DIST: 'zulu' + JAVA_VERSION: 17 + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@v3 + + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DIST }} + cache: gradle + + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Build + run: ./gradlew build --stacktrace diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..27b3c9a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,120 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - 'v1.18-*.*.*' + +env: + JAVA_DIST: 'zulu' + JAVA_VERSION: 17 + MOD_ID: 'almostunified' + MOD_NAME: 'AlmostUnified' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@v3 + + - name: Set up JDK ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DIST }} + cache: gradle + + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Assemble the JARs + run: ./gradlew assemble + + - name: Move JARs to build directory + run: | + mkdir -p build/libs + mv -f Forge/build/libs/*.jar build/libs + mv -f Fabric/build/libs/*.jar build/libs + + - name: Collect version information + run: | + shopt -s failglob # print a warning if a glob does not match anything + set_var() { + echo $1="$2" + echo $1="$2" >> $GITHUB_ENV + declare -g $1="$2" + } + set_var JAR_FILE $(eval echo build/libs/${{ env.MOD_ID }}-*-*-*.jar) + set_var MINECRAFT_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f3) + set_var MOD_VERSION $(echo ${JAR_FILE%.*} | cut -d- -f4) + set_var RELEASE_TYPE "$(echo ${GITHUB_REF##*/} | cut -d- -f5)" + set_var RELEASE_TYPE "$([[ -z $RELEASE_TYPE ]] && echo release || echo $RELEASE_TYPE)" + + - name: Install changelog parser + uses: taiki-e/install-action@parse-changelog + + - name: Parse changelog + run: parse-changelog CHANGELOG.md ${{ env.MOD_VERSION }} > changes.md + + - name: Release Fabric to CF and MR + uses: Kir-Antipov/mc-publish@v3.1 + with: + curseforge-id: 633823 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + modrinth-id: sdaSaQEz + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + files: build/libs/${{ env.MOD_ID }}-fabric-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar + name: ${{ env.MOD_NAME }}-Fabric-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }} + version: ${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}+fabric + version-type: ${{ env.RELEASE_TYPE }} + changelog-file: changes.md + + loaders: fabric + game-versions: ${{ env.MINECRAFT_VERSION }} + version-resolver: exact + java: ${{ env.JAVA_VERSION }} + retry-attempts: 2 + retry-delay: 10000 + + - name: Release Forge to CF and MR + uses: Kir-Antipov/mc-publish@v3.1 + with: + curseforge-id: 633823 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + modrinth-id: sdaSaQEz + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + files: build/libs/${{ env.MOD_ID }}-forge-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar + name: ${{ env.MOD_NAME }}-Forge-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }} + version: ${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}+forge + version-type: ${{ env.RELEASE_TYPE }} + changelog-file: changes.md + + loaders: forge + game-versions: ${{ env.MINECRAFT_VERSION }} + version-resolver: exact + java: ${{ env.JAVA_VERSION }} + retry-attempts: 2 + retry-delay: 10000 + + - name: Release to GitHub + uses: Kir-Antipov/mc-publish@v3.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + files: build/libs/${{ env.MOD_ID }}-*-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar + version: ${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }} + version-type: ${{ env.RELEASE_TYPE }} + changelog-file: changes.md + retry-attempts: 2 + retry-delay: 10000 diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml new file mode 100644 index 0000000..dcb2bd1 --- /dev/null +++ b/.github/workflows/support.yml @@ -0,0 +1,9 @@ +name: "Support Requests" + +on: + issues: + types: [labeled, unlabeled, reopened] + +jobs: + support-requests: + uses: AlmostReliable/.github/.github/workflows/support.yml@main diff --git a/Fabric/build.gradle.kts b/Fabric/build.gradle.kts index 90e34e5..7726f57 100644 --- a/Fabric/build.gradle.kts +++ b/Fabric/build.gradle.kts @@ -14,7 +14,7 @@ val mappingsVersion: String by project val reiVersion: String by project val jeiVersion: String by project -val baseArchiveName = "${modName}-fabric-${minecraftVersion}" +val baseArchiveName = "${modId}-fabric-${minecraftVersion}" base { archivesName.set(baseArchiveName) diff --git a/Forge/build.gradle.kts b/Forge/build.gradle.kts index 500da05..8af0d14 100644 --- a/Forge/build.gradle.kts +++ b/Forge/build.gradle.kts @@ -19,7 +19,7 @@ val jeiVersion: String by project val almostlibVersion: String by project -val baseArchiveName = "${modName}-forge-${minecraftVersion}" +val baseArchiveName = "${modId}-forge-${minecraftVersion}" base { archivesName.set(baseArchiveName) diff --git a/gradle.properties b/gradle.properties index d4f2ece..77c69f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Project -version = 1.0.0 +version = 0.0.1 group = com.almostreliable.unified license = GNU Lesser General Public License v3.0 mixinVersion = 0.8.5