-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
136 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,163 +1,68 @@ | ||
name: build (multiversion branch) | ||
name: build | ||
on: [ pull_request, push ] | ||
|
||
jobs: | ||
webhook-message: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get branch name | ||
id: get_branch | ||
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | ||
|
||
- name: send building message to discord | ||
if: "!startsWith(github.event.head_commit.message, '[skip]')" | ||
uses: realRobotix/action-discord-notifier@release-master | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
message-title: Building mod from branch ${{ steps.get_branch.outputs.branch }} | ||
|
||
- name: send not building message to discord | ||
if: "startsWith(github.event.head_commit.message, '[skip]')" | ||
uses: realRobotix/action-discord-notifier@release-master | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
message-title: Build skipped for branch ${{ steps.get_branch.outputs.branch }} | ||
|
||
|
||
build_1_19: | ||
if: "!startsWith(github.event.head_commit.message, '[skip]')" | ||
if: !startsWith(github.event.head_commit.message, '[skip]') | ||
strategy: | ||
matrix: | ||
java: [ 17 ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: steal code from repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup jdk ${{ matrix.java }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: zulu | ||
cache: gradle | ||
|
||
- name: cache gradle | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/loom-cache | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: give gradle permission to murder github servers | ||
run: chmod +x ./gradlew | ||
|
||
- name: gradle murders github servers | ||
run: ./gradlew assemble -PmcVer="1.19.2" | ||
|
||
- name: upload forge build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-forge-1.19.2 | ||
path: forge/build/libs/*.jar | ||
|
||
- name: upload fabric build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-fabric-1.19.2 | ||
path: fabric/build/libs/*.jar | ||
|
||
- name: upload merged build artifact to github | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-merged-1.19.2 | ||
path: | | ||
build/libs/merged/*.jar | ||
- name: upload merged build artifact to discord | ||
if: success() | ||
uses: sinshutu/upload-to-discord@master | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
with: | ||
args: build/libs/merged/*.jar | ||
|
||
- name: send build failure message to discord | ||
if: failure() | ||
uses: ilshidur/action-discord@master | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
- name: send skipped message | ||
uses: appleboy/discord-action@v1.0.0 | ||
with: | ||
args: 'Build failed for 1.19.2!' | ||
|
||
|
||
build_1_20: | ||
if: "!startsWith(github.event.head_commit.message, '[skip]')" | ||
strategy: | ||
matrix: | ||
java: [ 17 ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: steal code from repository | ||
webhook_id: ${{ secrets.WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.WEBHOOK_TOKEN }} | ||
args: '# Build #${{ github.run_number }} skipped' | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: setup jdk ${{ matrix.java }} | ||
- name: install java ${{ matrix.java }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: zulu | ||
cache: gradle | ||
|
||
- name: cache gradle | ||
- name: cache loom | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/loom-cache | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }} | ||
path: ~/.gradle/loom-cache | ||
key: loom-cache-${{ runner.os }}-gradle-${{ hashFiles('~/.gradle/loom-cache/**') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: give gradle permission to murder github servers | ||
run: chmod +x ./gradlew | ||
|
||
- name: gradle murders github servers | ||
run: ./gradlew assemble -PmcVer="1.20.1" | ||
- name: give scripts execution permissions | ||
run: chmod +x gradlew buildAll | ||
|
||
- name: upload forge build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-forge-1.20.1 | ||
path: forge/build/libs/*.jar | ||
- name: Run build script | ||
run: ./buildAll | ||
|
||
- name: upload fabric build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-fabric-1.20.1 | ||
path: fabric/build/libs/*.jar | ||
- name: upload non-merged artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: ./artifacts/** | ||
|
||
- name: upload merged build artifact to github | ||
- name: upload merged artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cu-artifacts-merged-1.20.1 | ||
path: | | ||
build/libs/merged/*.jar | ||
name: merged-artifacts | ||
path: ./build/libs/merged/*.jar | ||
|
||
- name: upload merged build artifact to discord | ||
- name: send artifacts to webhook | ||
if: success() | ||
uses: sinshutu/upload-to-discord@master | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: appleboy/discord-action@v1.0.0 | ||
with: | ||
args: build/libs/merged/*.jar | ||
webhook_id: ${{ secrets.WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.WEBHOOK_TOKEN }} | ||
args: '# Build #${{ github.run_number }}' | ||
file: build/libs/merged/*.jar | ||
|
||
- name: send build failure message to discord | ||
- name: send failure message | ||
if: failure() | ||
uses: ilshidur/action-discord@master | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: appleboy/discord-action@v1.0.0 | ||
with: | ||
args: 'Build failed for 1.20.1!' | ||
webhook_id: ${{ secrets.WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.WEBHOOK_TOKEN }} | ||
args: '# Build #${{ github.run_number }} failed' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
mkdir -p artifacts || true | ||
|
||
for d in versionProperties/*; do | ||
version=$(echo "$d" | sed "s/versionProperties\///" | sed "s/.properties//") | ||
|
||
echo "==================== Cleaning workspace to build $version ====================" | ||
sh gradlew clean -PmcVer="$version" --no-daemon || true | ||
echo "====================Building $version ====================" | ||
sh gradlew assemble -PmcVer="$version" --no-daemon || true | ||
echo "==================== Moving jars ====================" | ||
echo '' | ||
mv "forge/build/libs/*" "artifacts/$version/" || true | ||
mv "fabric/build/libs/*" "artifacts/$version/" || true | ||
echo '' | ||
done |
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
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