Skip to content

feat: Add Capacitor and CC compat #75

feat: Add Capacitor and CC compat

feat: Add Capacitor and CC compat #75

Workflow file for this run

# MIT Liscence (c) CompactMods/CompactCrafting
name: Gradle Tests
env:
GH_PKG_URL: "https://maven.pkg.github.com/katcodesmods/mffs"
MFFS_RELEASE: false
on:
workflow_dispatch:
inputs:
diagnostic_mode:
description: Diagnostic Mode
type: boolean
default: false
required: true
push:
branches:
- '**'
- '!l10n_main'
tags-ignore:
- v*
paths-ignore:
- "README.md"
- "LICENSE"
- 'CHANGELOG.md'
- 'version.json'
- ".github/**/*"
permissions: write-all
jobs:
vars:
name: Get Variables
runs-on: ubuntu-22.04
outputs:
version: ${{steps.changelog.outputs.version}}
mcVersion: ${{steps.gradle_props.outputs.mc_version}}
forgeVersion: ${{steps.gradle_props.outputs.forge_version}}
new_sha: ${{steps.sha.outputs.SHA}}
changelog: ${{steps.changelog.outputs.clean_changelog}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
skip-git-pull: "true"
version-file: "version.json"
version-path: "version"
skip-on-empty: "false"
pre-release: "true"
- name: Read MC and Forge versions
id: gradle_props
uses: christian-draeger/[email protected]
with:
path: "gradle.properties"
properties: "mc_version forge_version"
- name: Get Sha
id: sha
run: |
export sha_new=$(git rev-parse HEAD)
echo $sha_new
echo "::set-output name=SHA::$sha_new"
- run:
echo ${{ steps.sha.outputs.SHA }}
build-info:
name: Build Info
runs-on: ubuntu-22.04
needs: [ vars ]
steps:
- name: Output
run: |
echo "Version: ${{ needs.vars.outputs.version }}"
echo "Packages URL: ${{ env.GH_PKG_URL }}"
tests:
name: Gradle Tests
runs-on: ubuntu-22.04
needs: [vars]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{needs.var.outputs.new_sha}}
- name: Check SHA
if: inputs.diagnostic_mode
run: |
echo " SHA: ${{needs.var.outputs.new_sha}} "
sha_new=$(git rev-parse HEAD)
echo $sha_new
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Prepare Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/production' }}
- name: Diagnostic Output
if: inputs.diagnostic_mode
run: |
echo "Java Home: ${{env.JAVA_HOME}}"
./gradlew -q dependencies
- name: Directory Structure Diagnostic
if: inputs.diagnostic_mode
run: tree > filetree.txt
- name: Make Directories
run: |
mkdir run
mkdir run/data
mkdir run/test
mkdir run/tests
- name: Generate Datagen Assets
run: ./gradlew :runData
env:
MFFS_VERSION: ${{ needs.vars.outputs.version }}
- name: Store Built Assets
if: success()
uses: actions/upload-artifact@v3
with:
name: generated-data
path: src/generated/resources
- name: Upload Failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: generated-data-failure
path: .
- name: Test JAR with GameTest Server
run: ./gradlew runGameTestServer
env:
MFFS_VERSION: ${{ needs.vars.outputs.version }}
MFFS_TESTS: true
- name: Upload build failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-data
path: run/tests
- name: Save Test Results
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: 'run/tests/*.xml'
publish-gh-package:
name: Publish Github Package
runs-on: ubuntu-22.04
needs: [ vars, tests ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{needs.var.outputs.new_sha}}
- name: Unshallow and Get Tags
run: git fetch --prune --unshallow --tags
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Pull Built Data
uses: actions/download-artifact@v3
with:
name: generated-data
path: src/generated/resources
- name: Publish gradle nightly jar
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository
env:
MFFS_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: katcodesmods
repo: mffs
group: dev.katcodes.mffs
filter: "^mffs-(?:[\\d\\.]+)-rc\\.(?:[\\d]+)\\.jar$"
outputFile: mffs-nightly.json
- name: Debug output
run: |
echo "Version: ${{ steps.download-info.outputs.version }}"
cat mffs-nightly.json
- name: Read info into variable [latest]
id: info
run: echo "latestJson=$(cat mffs-nightly.json)" >> $GITHUB_OUTPUT
- name: Download JAR and prepare artifacts
run: |
mkdir release
echo "URL: ${{ fromJson(steps.info.outputs.latestJson)[0].url }}"
curl -L "${{ fromJson(steps.info.outputs.latestJson)[0].url }}" -o "release/${{ fromJson(steps.info.outputs.latestJson)[0].name}}"
mv mffs-nightly.json release/mffs-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 mffs-nightly.json)" >> $GITHUB_OUTPUT
- name: Announce Release
uses: katrinaas/[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: MFFS
modVersion: ${{ needs.get-package-info.outputs.version }}
thumbnail: https://media.forgecdn.net/avatars/4/216/635351425655502638.png
forgeVersion: ${{ needs.vars.outputs.forgeVersion }}
mcVersion: ${{ needs.vars.outputs.mcVersion }}
forge_emote: "626138509853458435"
mc_emote: "1069393008442740787"
changelog: ${{needs.vars.outputs.changelog}}