修改版本号格式 #6
Workflow file for this run
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
on: | |
push: | |
paths: | |
- src/** | |
- build.gradle | |
- gradle.properties | |
- settings.gradle | |
jobs: | |
build: | |
strategy: | |
matrix: | |
java: [ 17 ] | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: checkout | |
uses: actions/[email protected] | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: setup java ${{ matrix.java }} | |
uses: actions/[email protected] | |
with: | |
distribution: 'zulu' | |
java-version: ${{ matrix.java }} | |
- name: Setup cache | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
- name: make gradle wrapper executable | |
if: ${{ runner.os != 'Windows' }} | |
run: chmod +x ./gradlew | |
- name: Set build number | |
run: sed -i "s/undefined/$GITHUB_RUN_NUMBER/g" gradle.properties | |
- name: build | |
run: ./gradlew build | |
- name: Find correct JAR | |
id: find-jar | |
run: | | |
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" | |
echo "jarname=$output" >> $GITHUB_OUTPUT | |
- name: capture build artifacts | |
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} | |
uses: actions/[email protected] | |
with: | |
name: ${{ steps.find-jar.outputs.jarname }} | |
path: build/libs/${{ steps.find-jar.outputs.jarname }} |