diff --git a/.github/workflows/announce-latest-nightly.yml b/.github/workflows/announce-latest-nightly.yml index df9f4a75..e437a014 100644 --- a/.github/workflows/announce-latest-nightly.yml +++ b/.github/workflows/announce-latest-nightly.yml @@ -1,6 +1,8 @@ name: Announce Latest Nightly to Discord on: + workflow_call: + workflow_dispatch: inputs: diagnostic_mode: @@ -45,7 +47,7 @@ jobs: owner: compactmods repo: compactmachines group: dev.compactmods.compactmachines - filter: "^compactmachines-forge-(?:[\\d\\.]+)-nightly.jar$" + filter: "^compactmachines-neoforge-(?:[\\d\\.]+)-nightly.jar$" outputFile: compactmachines-nightly.json - name: Debug output diff --git a/.github/workflows/build-info.yml b/.github/workflows/build-info.yml deleted file mode 100644 index a7d0a333..00000000 --- a/.github/workflows/build-info.yml +++ /dev/null @@ -1,63 +0,0 @@ - -name: Build Information (Last Tag) -on: workflow_dispatch - -jobs: - info: - name: Info - runs-on: ubuntu-20.04 - outputs: - release_type: ${{steps.cf_release_type.outputs.value }} - cf_project: ${{steps.cf_project.outputs.value }} - mod_id: ${{steps.mod_id.outputs.value }} - version: ${{steps.version.outputs.version }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Release Type - id: cf_release_type - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'cf_release_type' - - - name: Project ID - id: cf_project - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'cf_project' - - - name: Mod ID - id: mod_id - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'mod_id' - - - name: Find Current Tag - id: current - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: '*-rc*' - commit-ish: '@' - skip-unshallow: 'true' - - - name: Semver Version - id: version - run: | - version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2) - echo "::set-output name=version::$version" - - output: - name: Output Info - runs-on: ubuntu-20.04 - needs: [ info ] - steps: - - run: echo "${{needs.info.outputs.mod_id}} version ${{needs.info.outputs.version}}; releasing as ${{needs.info.outputs.release_type}}" diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml deleted file mode 100644 index 2640cdf6..00000000 --- a/.github/workflows/changelog.yml +++ /dev/null @@ -1,72 +0,0 @@ -# Generates a changelog between two version-tagged commits. -name: Generate Changelog - -# Controls when the action will run. Workflow runs when manually triggered using the UI -# or API. -on: workflow_dispatch - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - generate: - name: Generate Changelog - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Find Current Tag - id: current - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: '*-rc*' - commit-ish: '@' - skip-unshallow: 'true' - - - name: Previous Tag - id: last - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: ${{steps.current.outputs.tag}} - skip-unshallow: 'true' - - - name: Generate changelog - uses: jimschubert/beast-changelog-action@v1 - with: - GITHUB_TOKEN: ${{github.token}} - CONFIG_LOCATION: .github/changelog.json - FROM: ${{steps.last.outputs.tag}} - TO: ${{steps.current.outputs.tag}} - OUTPUT: .github/CHANGELOG.md - - - name: Read CHANGELOG file - id: getchangelog - run: echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)" - - - name: View Changelog - run: cat .github/CHANGELOG.md - - - name: Add Artifact - uses: actions/upload-artifact@v2 - with: - name: out - path: .github/CHANGELOG.md - - view: - name: View Changelog Output - runs-on: ubuntu-latest - needs: [generate] - steps: - - name: Download Build Results - uses: actions/download-artifact@v2 - with: - name: out - path: out - - - run: cat out/CHANGELOG.md - - # {needs.generate.outputs.changelog}} diff --git a/.github/workflows/ci-tests-nightly.yml b/.github/workflows/ci-tests-nightly.yml deleted file mode 100644 index 6ba3076f..00000000 --- a/.github/workflows/ci-tests-nightly.yml +++ /dev/null @@ -1,191 +0,0 @@ -name: Gradle Tests and Nightly (CI) - -env: - GH_PKG_URL: "https://maven.pkg.github.com/${{ github.repository }}" - -on: - workflow_dispatch: - push: - paths-ignore: - - "README.md" - - "LICENSE" - - ".github/**/*" - -jobs: - vars: - name: Get Variables - runs-on: ubuntu-22.04 - outputs: - version: ${{steps.version.outputs.version}} - mcVersion: ${{steps.gradle_props.outputs.minecraft_version}} - forgeVersion: ${{steps.gradle_props.outputs.forge_version}} - - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Version - id: version - uses: paulhatch/semantic-version@v5.0.2 - with: - change_path: "forge-main" - version_format: "${major}.${minor}.${patch}.${increment}-nightly" - search_commit_body: true - - - name: Read MC and Forge versions - id: gradle_props - uses: christian-draeger/read-properties@1.1.1 - with: - path: "gradle.properties" - properties: "minecraft_version forge_version" - - tests: - name: Gradle Tests - runs-on: ubuntu-22.04 - needs: [ vars ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Prepare Gradle - uses: gradle/gradle-build-action@v2 - - - name: Datagen - uses: gradle/gradle-build-action@v2 - with: - arguments: :forge-datagen:runData - env: - CM_VERSION: ${{ needs.vars.outputs.version }} - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Store Built Assets - if: success() - uses: actions/upload-artifact@v3 - with: - name: generated-data - path: forge-main/src/generated/resources - - - name: Game Tests - uses: gradle/gradle-build-action@v2 - with: - arguments: runGameTestServer - env: - CM_VERSION: ${{ needs.vars.outputs.version }} - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Upload build failure - if: failure() - uses: actions/upload-artifact@v3 - with: - name: test-data - path: run/gametest - - publish-gh-package: - name: Publish Github Package - Nightly - runs-on: ubuntu-22.04 - needs: [ vars, tests ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Pull Built Generated Data - uses: actions/download-artifact@v3 - with: - name: generated-data - path: forge-main/src/generated/resources - - - name: Publish - uses: gradle/gradle-build-action@v2 - with: - arguments: publish - env: - CM_VERSION: ${{ needs.vars.outputs.version }} - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - get-package-info: - name: Get Latest Package Info - runs-on: ubuntu-22.04 - needs: [ publish-gh-package ] - outputs: - version: ${{ steps.download-info.outputs.version }} - steps: - - name: Download Package Info - id: download-info - uses: compactmods/dl-package-info@1.0.2 - env: - GQL_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - owner: compactmods - repo: compactmachines - group: dev.compactmods.compactmachines - filter: "^compactmachines-forge-(?:[\\d\\.]+)-nightly.jar$" - outputFile: compactmachines-nightly.json - - - name: Store Package Info - if: success() - uses: actions/upload-artifact@v3 - with: - name: package-info - path: compactmachines-nightly.json - - - name: Read info into variable [latest] - id: info - run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT - - - name: Download JAR and prepare artifacts - run: | - mkdir release - curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}" - mv compactmachines-nightly.json release/compactmachines-nightly.json - - - name: Add Artifact - uses: actions/upload-artifact@v3 - with: - name: release - path: release - - announce: - name: Discord Announcement - needs: [ vars, get-package-info ] - runs-on: ubuntu-22.04 - steps: - - name: Grab JAR and Info - uses: actions/download-artifact@v3 - with: - name: release - path: . - - - name: Read info into variable [latest] - id: info - run: echo "latestJson=$(cat compactmachines-nightly.json)" >> $GITHUB_OUTPUT - - - name: Announce Release - uses: compactmods/discord-releaser@0.1.5 - env: - DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} - with: - filename: ${{ fromJson(steps.info.outputs.latestJson)[0].name}} - channel: ${{ secrets.NIGHTLY_CHANNEL_ID }} - modName: Compact Machines - modVersion: ${{ needs.get-package-info.outputs.version }} - thumbnail: https://media.forgecdn.net/avatars/10/602/635460270800375500.png - - forgeVersion: ${{ needs.vars.outputs.forgeVersion }} - mcVersion: ${{ needs.vars.outputs.mcVersion }} \ No newline at end of file diff --git a/.github/workflows/manual-gh-packages.yml b/.github/workflows/manual-gh-packages.yml deleted file mode 100644 index ad46ea6f..00000000 --- a/.github/workflows/manual-gh-packages.yml +++ /dev/null @@ -1,145 +0,0 @@ -# Creates releases on GH Packages based on a version tag -name: Manual Tagged Github Packages Release - -on: - workflow_dispatch: - -jobs: - vars: - name: Get Variables - runs-on: ubuntu-20.04 - outputs: - release_type: ${{steps.cf_release_type.outputs.value }} - cf_project: ${{steps.cf_project.outputs.value }} - mod_version: ${{steps.mod_version.outputs.value }} - mod_id: ${{steps.mod_id.outputs.value }} - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Release Type - id: cf_release_type - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'cf_release_type' - - - name: Project ID - id: cf_project - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'cf_project' - - - name: Mod Version - id: mod_version - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'mod_version' - - - name: Mod ID - id: mod_id - uses: christian-draeger/read-properties@1.0.1 - with: - path: './gradle.properties' - property: 'mod_id' - - changelog: - name: Generate Changelog (tags) - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow - - - name: Find Current Tag - id: current - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: '*-rc*' - commit-ish: '@' - skip-unshallow: 'true' - - - name: Previous Tag - id: last - uses: jimschubert/query-tag-action@v1 - with: - include: 'v*' - exclude: ${{steps.current.outputs.tag}} - skip-unshallow: 'true' - - - name: Generate changelog - uses: jimschubert/beast-changelog-action@v1 - with: - GITHUB_TOKEN: ${{github.token}} - CONFIG_LOCATION: .github/changelog.json - FROM: ${{steps.last.outputs.tag}} - TO: ${{steps.current.outputs.tag}} - OUTPUT: .github/CHANGELOG.md - - - name: Read CHANGELOG file - id: getchangelog - run: echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)" - - - name: View Changelog - run: cat .github/CHANGELOG.md - - - name: Add Artifact - uses: actions/upload-artifact@v2 - with: - name: out - path: .github/CHANGELOG.md - - jar: - name: Publish JAR - runs-on: ubuntu-20.04 - needs: [vars, changelog] - steps: - - name: Download Changelog Results - uses: actions/download-artifact@v2 - with: - name: out - path: changelog - - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: "17" - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Publish JAR with Gradle - run: ./gradlew publishReleasePublicationToGitHubPackagesRepository -x test - env: - CM_RELEASE: true - GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Add Artifact - uses: actions/upload-artifact@v2 - with: - name: libs - path: | - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}.jar - build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.mod_version }}-api.jar - - view: - name: View Changelog Output - runs-on: ubuntu-20.04 - needs: [changelog] - steps: - - name: Download Build Results - uses: actions/download-artifact@v2 - with: - name: out - path: changelog - - run: cat changelog/CHANGELOG.md \ No newline at end of file diff --git a/.github/workflows/nightly-builds.yml b/.github/workflows/nightly-builds.yml new file mode 100644 index 00000000..4726813e --- /dev/null +++ b/.github/workflows/nightly-builds.yml @@ -0,0 +1,112 @@ +name: Gradle Tests and Nightly (CI) + +env: + GH_PKG_URL: "https://maven.pkg.github.com/${{ github.repository }}" + +on: + workflow_dispatch: + push: + paths-ignore: + - "README.md" + - "LICENSE" + - ".github/**/*" + +jobs: + vars: + name: Get Variables + runs-on: ubuntu-22.04 + outputs: + version: ${{steps.version.outputs.version}} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Version + id: version + uses: paulhatch/semantic-version@v5.0.2 + with: + change_path: "neoforge-main" + version_format: "${major}.${minor}.${patch}.${increment}-nightly" + search_commit_body: true + + tests: + name: Gradle Tests + runs-on: ubuntu-22.04 + needs: [ vars ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Datagen + uses: gradle/gradle-build-action@v2 + with: + arguments: runData + env: + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Store Built Assets + if: success() + uses: actions/upload-artifact@v3 + with: + name: generated-data + path: neoforge-main/src/generated/resources + + - name: Game Tests + uses: gradle/gradle-build-action@v2 + with: + arguments: runGameTestServer + env: + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload build failure + if: failure() + uses: actions/upload-artifact@v3 + with: + name: test-data + path: run/gametest + + publish-gh-package: + name: Publish Github Package - Nightly + runs-on: ubuntu-22.04 + needs: [ vars, tests ] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Pull Built Generated Data + uses: actions/download-artifact@v3 + with: + name: generated-data + path: neoforge-main/src/generated/resources + + - name: Publish + uses: gradle/gradle-build-action@v2 + with: + arguments: publish + env: + VERSION: ${{ needs.vars.outputs.version }} + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + announce: + name: Discord Announcement + needs: [ publish-gh-package ] + uses: ./.github/workflows/announce-latest-nightly.yml + secrets: inherit \ No newline at end of file diff --git a/neoforge-main/build.gradle.kts b/neoforge-main/build.gradle.kts index 886316f5..cf1ef6d0 100644 --- a/neoforge-main/build.gradle.kts +++ b/neoforge-main/build.gradle.kts @@ -34,7 +34,7 @@ coreProjects.forEach { base { archivesName.set(modId) - group = "dev.compactmods" + group = "dev.compactmods.compactmachines" version = envVersion } @@ -208,4 +208,23 @@ tasks.jarJar { coreProjects.forEach { from (it.sourceSets.main.get().output) } +} + +val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines" +publishing { + publications.register("compactmachines") { + artifactId = "$modId-neoforge" + from(components.getByName("java")) + } + + repositories { + // GitHub Packages + maven(PACKAGES_URL) { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } \ No newline at end of file