Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build Mod

on:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "temurin"

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build with Gradle
run: ./gradlew build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: mod-jars
path: build/libs/*.jar
retention-days: 30

- name: Comment PR with artifact URLs
if: success() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});

let comment = '🦾 Fresh bends, straight out the oven, ready to be tested out:\n';
for (const artifact of artifacts.data.artifacts) {
const download_url = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${artifact.id}`;
comment += `- [${artifact.name}](${download_url})\n`;
}

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment,
});

- name: Upload build artifacts (on failure)
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs
path: |
build/logs/
.gradle/
retention-days: 7
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*

!/.github
!/build\.gradle
!/gradle\.properties
!/src
!/misc
!/gradle
!gradlew
!gradlew.bat
!/gradlew
!/gradlew.bat