More mdg-related stuff (broken ATM) #107
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: "Build applicable branches on push" | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events for the branches listed | |
on: | |
push: | |
branches: [ "MC1.*" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: | | |
!contains(github.event.head_commit.message, '[ci skip]') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Remove any generated assets/data | |
run: rm -rf ./src/generated | |
- name: Generate assets & data | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: false | |
arguments: runData --no-daemon | |
- name: Validate assets | |
run: test -d ./src/generated -a -d ./src/generated/resources/.cache | |
- name: Set up mod metadata | |
id: mod_meta | |
run: | | |
echo mc_version=$(grep ^minecraft_version= ./gradle.properties | cut -d= -f2) >> $GITHUB_OUTPUT | |
- name: Build JAR | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: false | |
arguments: build --no-daemon | |
- name: Publish to Modmaven | |
uses: gradle/actions/setup-gradle@v3 | |
env: | |
MODMAVEN_USER: ${{ secrets.MODMAVEN_USER }} | |
MODMAVEN_PASSWORD: ${{ secrets.MODMAVEN_PASSWORD }} | |
with: | |
cache-read-only: false | |
arguments: publishMavenPublicationToModmavenRepository --no-daemon | |
- name: Discord notification | |
uses: Ilshidur/action-discord@master | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
if: | |
env.DISCORD_WEBHOOK != null | |
with: | |
args: 'Build complete for project {{ EVENT_PAYLOAD.repository.full_name }} (Minecraft ${{ steps.mod_meta.outputs.mc_version}}): ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.' |