-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (53 loc) · 1.62 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
branch: [ 'main' ]
steps:
- name: Check out
uses: actions/checkout@v2
- name: Change branch
run: |
git fetch
git checkout ${{ matrix.branch }}
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Set build number
run: sed -i "s/undefined/$GITHUB_RUN_NUMBER/g" gradle.properties
- name: Give permission
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Get jar
id: getjar
run: |
output="$(find build/libs/ -type f -printf "%f\n")"
echo "::set-output name=jarname::$output"
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: build/libs/
- name: Upload jar to Github release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/libs/${{ steps.getjar.outputs.jarname }}
asset_name: ${{ steps.getjar.outputs.jarname }}
asset_content_type: application/java-archive
- name: Publish to maven
run: ./gradlew publish
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}