优化构建文件 + 移出build文件夹 #448
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 | |
on: [ pull_request, push ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Make Gradle Wrapper Executable | |
run: chmod +x ./gradlew | |
- name: Build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
cache-read-only: false | |
- name: Get Short Commit Hash | |
id: get_short_commit_hash | |
run: | | |
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) | |
echo "short_sha=$short_sha" >> $GITHUB_OUTPUT | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MC-Discord-Chat ${{ steps.get_short_commit_hash.outputs.short_sha }} | |
path: build/*.jar |