Last WIP before starting port to 1.20.4 #184
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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/[email protected] | |
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/[email protected] | |
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/[email protected] | |
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 }} |