Skip to content

Commit

Permalink
add build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Jan 7, 2025
1 parent 42e0a78 commit 116ee60
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 118 deletions.
77 changes: 0 additions & 77 deletions .github/workflows/artifact-comment.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/artifact-upload.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build

on:
push:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled

jobs:
build:
# The goal of the build workflow is split into multiple requirements.
# 1. Run on pushes to same repo.
# 2. Run on PR open/reopen/syncs from repos that are not the same (PRs from the same repo are covered by 1)
# 3. Run on labeled PRs that have the build-pr-jar flag.
# This snippet was taken from Paper's workflow.
if: >
(
(github.event_name == 'push')
|| (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name && contains(fromJSON('["opened", "reopened", "synchronize"]'), github.event.action))
|| (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'build-pr-jar')
)
runs-on: ubuntu-latest

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

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: current

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

- name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }} Build
path: build/libs

- name: Find Comment
uses: peter-evans/find-comment@v4
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Build output
${{ steps.build.outputs.build-log }}
edit-mode: replace

0 comments on commit 116ee60

Please sign in to comment.