generated from TabooLib/taboolib-sdk
-
Notifications
You must be signed in to change notification settings - Fork 5
152 lines (152 loc) · 5.41 KB
/
main_17.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: build_16
on:
push:
branches:
- master
jobs:
build:
name: Build Jar1
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk 8.0
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8.0
- name: make gradle wrapper executable
run: chmod +x ./gradlew
# 第一次构建
- name: build
continue-on-error: true
id: build_1
run: ./gradlew build -Porder=$GITHUB_RUN_NUMBER
# 第二次构建
- name: build (retry 1)
continue-on-error: true
id: build_2
if: steps.build_1.outcome == 'failure'
run: ./gradlew build -Porder=$GITHUB_RUN_NUMBER
# 第三次构建
- name: build (retry 2)
continue-on-error: true
id: build_3
if: steps.build_2.outcome == 'failure'
run: ./gradlew build -Porder=$GITHUB_RUN_NUMBER
# 第四次构建
- name: build (retry 3)
id: build_4
if: steps.build_3.outcome == 'failure'
run: ./gradlew build -Porder=$GITHUB_RUN_NUMBER
# 上传构建文件
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
build-api:
name: Build API Jar
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk 8.0
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8.0
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
continue-on-error: true
id: build_api_1
run: ./gradlew build -Papi=common -Porder=$GITHUB_RUN_NUMBER
- name: build (retry 1)
continue-on-error: true
id: build_api_2
if: steps.build_api_1.outcome == 'failure'
run: ./gradlew build -Papi=common -Porder=$GITHUB_RUN_NUMBER
- name: build (retry 2)
continue-on-error: true
id: build_api_3
if: steps.build_api_2.outcome == 'failure'
run: ./gradlew build -Papi=common -Porder=$GITHUB_RUN_NUMBER
- name: build (retry 3)
id: build_api_4
if: steps.build_api_3.outcome == 'failure'
run: ./gradlew build -Papi=common -Porder=$GITHUB_RUN_NUMBER
# 上传构建文件
- name: capture build api artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs
release:
name: Release Jar
needs: [ build, build-api ]
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk 8.0
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 8.0
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: Get Project name
id: get_name
run: |
output=$(./gradlew properties)
name=$(echo "$output" | grep "^name:" | cut -d' ' -f2)
echo "Project name: $name"
echo "::set-output name=project_name::$name"
env:
project_name: ${{ steps.get_name.outputs.project_name }}
- name: Get Project version
id: get_version
run: |
output=$(./gradlew properties)
version=$(echo "$output" | grep "^version:" | cut -d' ' -f2)
echo "Project version: $version-$GITHUB_RUN_NUMBER"
echo "::set-output name=project_version::$version-$GITHUB_RUN_NUMBER"
env:
project_version: ${{ steps.get_version.outputs.project_version }}
- name: Download Content
uses: actions/download-artifact@v2
with:
name: Artifacts
- name: Create release
id: create-new-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.project_version }}
release_name: ${{ steps.get_version.outputs.project_name }} ${{ steps.get_version.outputs.project_version }}
- name: Upload API Jar asset to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
asset_path: ${{ steps.get_name.outputs.project_name }}-${{ steps.get_version.outputs.project_version }}-api.jar
asset_name: ${{ steps.get_name.outputs.project_name }}-${{ steps.get_version.outputs.project_version }}-api.jar
asset_content_type: application/zip
- name: Upload Jar asset to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
asset_path: ${{ steps.get_name.outputs.project_name }}-${{ steps.get_version.outputs.project_version }}.jar
asset_name: ${{ steps.get_name.outputs.project_name }}-${{ steps.get_version.outputs.project_version }}.jar
asset_content_type: application/zip