Skip to content

Chisel module

Chisel module #1481

Workflow file for this run

# Creates a built artifact jar for apropriately labeled Pull Requests
name: PR Artifact
on:
pull_request:
types:
- labeled
- synchronize
# if a second commit is pushed quickly after the first, cancel the first one's build
concurrency:
group: build-artifact-${{github.head_ref}}
cancel-in-progress: true
env:
ARTIFACT_NAME: 'gregtech-dev'
NOTIFICATION_BODY: |
This Pull Request has automatic artifact deployment enabled. Download the latest build [here](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}), and extract the contents.
jobs:
Build_Artifact:
if: contains(github.event.pull_request.labels.*.name, format('deployment{0} artifact', ':'))
runs-on: ubuntu-latest
permissions:
pull-requests: write # needed to make a comment
contents: read # needed to checkout the repo if defining other permissions
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Build Project
uses: gradle/gradle-build-action@v2
with:
arguments: 'build --build-cache --no-daemon ' # disable daemon since only one gradle operation will happen
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
- name: Determine Artifact Name
id: artifact_name
run: |
FILE=(build/libs/*)
echo "artifact_name=${FILE[0]}" >> $GITHUB_OUTPUT
- name: Publish Artifact
uses: actions/upload-artifact@v3
with:
name: "${{env.ARTIFACT_NAME}}-${{github.head_ref}}-${{github.sha}}"
path: "${{steps.artifact_name.outputs.artifact_name}}"
if-no-files-found: error
- name: Find Existing Comment
uses: peter-evans/find-comment@v2
id: find-existing
with:
issue-number: ${{github.event.pull_request.number}}
comment-author: 'github-actions[bot]'
body-includes: 'Download the latest build [here]'
- name: Create or Update Artifact Publish Notification
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{github.event.pull_request.number}}
comment-id: ${{steps.find-existing.outputs.comment-id}}
edit-mode: replace
body: ${{env.NOTIFICATION_BODY}}