diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index af2231e3a3..5e0e54bc34 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -3,7 +3,7 @@ name: Latest Build on: push: branches: ['1.20.1', '1.21'] - paths-ignore: ['.github/**', '**/*.md'] + paths: ['src/**', '**/*.gradle', 'gradle.properties'] concurrency: group: auto-build-${{ github.ref }} @@ -13,24 +13,29 @@ jobs: build: runs-on: ubuntu-latest env: + GITHUB_TOKEN: ${{ github.token }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_USER: ${{ secrets.MAVEN_USER }} SNAPSHOT: true - GITHUB_TOKEN: ${{ github.token }} permissions: contents: write steps: - uses: actions/checkout@v4 - name: Setup Build uses: ./.github/actions/build_setup - - name: Get Version + - name: Get Mod Version id: ver run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT + - name: Version Suffix + id: suffix + run: echo "VERSION_SUFFIX=$(echo "${{ github.sha }}" | cut -c 1-7)" >> $GITHUB_ENV - name: Build run: ./gradlew build --build-cache - name: Publish to Maven if: github.repository_owner == 'GregTechCEu' run: ./gradlew publish --build-cache + - name: Rename Jars + run: for file in build/libs/*; do mv "$file" "${file/SHOT/SHOT-$(date --utc '+%Y%m%d-%H%M%S')-${{ env.VERSION_SUFFIX }}}"; done; - name: Upload Artifacts uses: actions/upload-artifact@v4 with: @@ -51,10 +56,10 @@ jobs: uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c with: tag_name: latest-${{ github.ref_name }} - name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT $$' + name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' prerelease: true body: | The latest build of GTM for Minecraft ${{ github.ref_name }}. Please report any [issues](https://github.com/GregTechCEu/GregTech-Modern/issues). ${{ steps.changelog.outputs.changelog }} - files: build/libs/*.jar \ No newline at end of file + files: build/libs/*.jar diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml deleted file mode 100644 index d531bc1dcd..0000000000 --- a/.github/workflows/auto-publish.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Auto Publish, Releasing - -on: - workflow_dispatch: - inputs: - releaseType: - description: 'release type' - required: true - type: choice - default: 'beta' - options: - - 'release' - - 'beta' - - 'alpha' - publishMaven: - description: 'whether publish to the maven' - required: true - type: boolean - default: true - publishCurseForgeAndModrinth: - description: 'whether to publish to curseforge and modrinth' - required: true - type: boolean - default: true - -jobs: - build: - runs-on: ubuntu-latest - env: - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MAVEN_USER: ${{ secrets.MAVEN_USER }} - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup Build - uses: ./.github/actions/build_setup - - - name: Build - run: ./gradlew build --build-cache - - - if: ${{ inputs.publishMaven }} - name: Publish to Maven - run: ./gradlew publish --build-cache - - - if: ${{ inputs.publishCurseForgeAndModrinth }} - name: Get Version - id: var - run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT - - - if: ${{ inputs.publishCurseForgeAndModrinth }} - name: mc-publish-forge - uses: Kir-Antipov/mc-publish@v3.3.0 - with: - github-tag: ${{ steps.var.outputs.version }} - github-token: ${{ secrets.GITHUB_TOKEN }} - - # Only include this section if you wish to publish - # your assets on Modrinth. - modrinth-id: 7tG215v7 - modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - - # Only include this section if you wish to publish - # your assets on CurseForge. - curseforge-id: 890405 - curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - - files: | - build/libs/!(*-@(dev|dev-all|dev-slim|sources|javadoc|dev-shadow|slim)).jar - build/libs/*-@(dev|sources|javadoc|dev-shadow|slim).jar - - name: GregTechCEu ${{ steps.var.outputs.version }} - version: mc${{ steps.var.outputs.version }} - version-type: ${{ inputs.releaseType }} - changelog-file: RELEASE.* - - loaders: | - forge - game-versions: | - ${{ github.ref_name }} - game-version-filter: none - java: | - 17 - retry-attempts: 2 - retry-delay: 10000 - fail-mode: fail diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index 451fc40a64..5eb2d5ec38 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -12,6 +12,8 @@ concurrency: jobs: build: runs-on: ubuntu-latest + env: + VERSION_SUFFIX: "PR-${{ github.event.number }}" steps: - uses: actions/checkout@v4 - name: Check Path Filter @@ -31,10 +33,20 @@ jobs: - name: Build if: steps.filter.outputs.code == 'true' run: ./gradlew assemble --build-cache - - name: Upload Artifact + - name: Rename Jars + if: steps.filter.outputs.code == 'true' + run: for file in build/libs/*; do mv "$file" "${file/.jar/-${{ env.VERSION_SUFFIX }}.jar}"; done; + - name: Upload All Artifacts if: steps.filter.outputs.code == 'true' uses: actions/upload-artifact@v4.0.0 with: - name: build output + name: Full Package path: build/libs/* retention-days: 15 + - name: Upload Main Jar + if: steps.filter.outputs.code == 'true' + uses: actions/upload-artifact@v4.0.0 + with: + name: Main Jar + path: build/libs/*[0-9]-PR-*.jar + retention-days: 15 diff --git a/.github/workflows/manage-pr-labels.yml b/.github/workflows/manage-pr-labels.yml index f879898659..3ef69bcd1f 100644 --- a/.github/workflows/manage-pr-labels.yml +++ b/.github/workflows/manage-pr-labels.yml @@ -3,19 +3,16 @@ name: Pull Request Labels # Checks for label once PR has been reviewed or label is applied on: - pull_request_review: - types: [submitted] pull_request: - types: [labeled] + types: [opened, labeled, unlabeled] concurrency: group: pr-labels-${{ github.head_ref }} cancel-in-progress: true jobs: - Labels: - name: On Approval - if: github.event_name == 'pull_request' || github.event.review.state == 'approved' + labels: + name: Label Check runs-on: ubuntu-latest permissions: pull-requests: read # needed to utilize required-labels diff --git a/gradle/scripts/resources.gradle b/gradle/scripts/resources.gradle index 7ff46fe72c..e89f53a031 100644 --- a/gradle/scripts/resources.gradle +++ b/gradle/scripts/resources.gradle @@ -10,6 +10,9 @@ def mod_description = getConfig("mod_description") def mod_url = getConfig("mod_url") def mod_issue_tracker = getConfig("mod_issue_tracker") +String suffix = System.getenv("VERSION_SUFFIX") +String version_toml = "$version" + (suffix ? "-$suffix" : "") + task printVersion { doLast { println mod_version @@ -21,7 +24,7 @@ task printVersion { var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { var forgeVers = forge.versions.forgeShortVersion.get().split("\\.")[0] var replaceProperties = [ - version : version, + version : version_toml, mod_id : mod_id, minecraft_version : libs.versions.minecraft.get(), loader_version : forgeVers,