Skip to content

Commit d037a7b

Browse files
committed
update github action
1 parent d3c4f04 commit d037a7b

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
- name: Set build version
3131
if: ${{ runner.os != 'Windows' }}
3232
run: |
33-
sed -i "s/pre_release = alpha/pre_release = beta/g" gradle.properties
33+
sed -i "s/pre_release=alpha/pre_release=beta/g" gradle.properties
3434
- name: capture build artifacts
35-
if: ${{ runner.os == 'Linux'}}
35+
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
3636
uses: actions/upload-artifact@v2
3737
with:
3838
name: Artifacts

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish Release
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
build:
8+
strategy:
9+
matrix:
10+
java: [ 17 ]
11+
os: [ ubuntu-20.04 ]
12+
branch: [ 1.16.x, 1.17.x, 1.18.x ]
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- name: checkout repository
16+
uses: actions/checkout@v2
17+
with:
18+
ref: ${{ matrix.branch }}
19+
- name: validate gradle wrapper
20+
uses: gradle/wrapper-validation-action@v1
21+
- name: setup jdk ${{ matrix.java }}
22+
uses: actions/setup-java@v1
23+
with:
24+
java-version: ${{ matrix.java }}
25+
- name: Set build version
26+
if: ${{ runner.os != 'Windows' }}
27+
run: |
28+
sed -i "s/pre_release=alpha/pre_release=/g" gradle.properties
29+
- name: make gradle wrapper executable
30+
if: ${{ runner.os != 'Windows' }}
31+
run: chmod +x ./gradlew
32+
- name: build
33+
run: ./gradlew build
34+
- name: Find correct JAR
35+
id: findjar
36+
run: |
37+
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")"
38+
echo "::set-output name=jarname::$output"
39+
- name: Upload assets to GitHub
40+
uses: AButler/[email protected]
41+
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
42+
with:
43+
files: build/libs/${{ steps.findjar.outputs.jarname }}
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)