-
Notifications
You must be signed in to change notification settings - Fork 75
78 lines (64 loc) · 2.06 KB
/
release-java.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Release Java
on:
workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
outputs:
VALUE: ${{ steps.set_short_hash.outputs.VALUE }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set SHORT_HASH
id: set_short_hash
run: |
echo "::set-output name=VALUE::${{ github.sha }}"
echo "RELEASE_TAG=${{ github.sha }}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV
- name: Goto Java folder
run: cd Java
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.3
- name: Create output folder
run: mkdir -p Java/FlySpring/edgechain-app/BuildOutput
- name: Build edgechain-app project
working-directory: Java/FlySpring/edgechain-app
run: mvn clean package -DskipTests
- name: Run edgechain testcases
working-directory: Java/FlySpring/edgechain-app
run: mvn test
- name: Copy edgechain-app JAR to Examples folder
run: cp Java/FlySpring/edgechain-app/target/edgechain.jar Java/FlySpring/edgechain-app/BuildOutput
- name: Upload Examples folder as artifact
uses: actions/upload-artifact@v2
with:
name: Output
path: Java/FlySpring/edgechain-app/BuildOutput
release:
name: release-java
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download jar from build
uses: actions/download-artifact@v2
with:
name: Output
path: Output
- name: Display structure of downloaded files
run: ls -R
- name: Get variables
id: vars
run: echo "tag_name=${{ env.RELEASE_TAG }}" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./Output/**/*.*
tag_name: ${{ env.RELEASE_TAG }}