-
Notifications
You must be signed in to change notification settings - Fork 76
78 lines (64 loc) · 2.22 KB
/
pr-build.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: Generate attachments
on:
# This workflow is started only on PRs
pull_request_target:
types:
- opened
- reopened
- synchronize
jobs:
# Main job
build:
permissions:
# Required to upload/save artifact, otherwise you'll get
# "Error: Resource not accessible by integration"
contents: write
# Required to post comment, otherwise you'll get
# "Error: Resource not accessible by integration"
pull-requests: write
runs-on: ubuntu-latest
outputs:
VALUE: ${{ steps.short_hash.outputs.VALUE }}
steps:
# Put your steps here to generate the files to upload.
# Usually configure Node.js, build, etc.
# Finally, upload the artifacts and post comment:
- name: Checkout PR
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Token for current repo (used to post PR comment)
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set SHORT_HASH
run: |
echo "::set-output name=VALUE::${LONG_HASH:0:8}"
echo "RELEASE_TAG=${LONG_HASH:0:8}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV
id: short_hash
env:
LONG_HASH: ${{ github.sha }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.3
- name: Create output folder
run: mkdir BuildOutput
- name: Build edgechain-app project
working-directory: ./FlySpring/edgechain-app
run: mvn clean package -DskipTests
- name: Run edgechain testcases
working-directory: ./FlySpring/edgechain-app
run: mvn test
- name: Copy edgechain-app JAR to Examples folder
run: cp ./FlySpring/edgechain-app/target/edgechain.jar ./BuildOutput/
- name: Upload Examples folder as artifact
uses: actions/upload-artifact@v3
with:
name: Output
path: ./BuildOutput/