forked from jeremylong/DependencyCheck
-
Notifications
You must be signed in to change notification settings - Fork 0
264 lines (256 loc) · 9.09 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: Build and Deploy Release
##
## Automates the release process
## 1. Update the 'body:' below and the release_notes.md
## 2. Run `./prepare-release.sh`
## 3. Create PR, merge PR
## 4. Run `git push origin main --tags`
##
permissions:
contents: write
on:
push:
tags:
- v*
jobs:
build:
name: Build dependency-check
runs-on: ubuntu-latest
steps:
- name: Install gpg secret key
id: install-gpg-key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- uses: actions/[email protected]
- name: Check Maven Cache
id: maven-cache
uses: actions/[email protected]
with:
path: ~/.m2/repository/
key: mvn-repo
- name: Check Local Maven Cache
id: maven-it-cache
uses: actions/[email protected]
with:
path: maven/target/local-repo
key: mvn-it-repo
- name: Check ODC Data Cache
id: odc-data-cache
uses: actions/[email protected]
with:
path: core/target/data
key: odc-data
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Set up JDK 1.8
id: jdk-8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'
server-id: ossrh
server-username: ${{ secrets.OSSRH_USERNAME }}
server-password: ${{ secrets.OSSRH_TOKEN }}
- uses: pnpm/[email protected]
with:
version: 6.0.2
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Get version
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "VERSION=$VERSION"
- name: Build Release with Maven
id: build-release
timeout-minutes: 120
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn -s settings.xml -Prelease "-DnexusUrl=https://oss.sonatype.org/" clean package source:jar javadoc:jar gpg:sign deploy site site:stage -DreleaseTesting --no-transfer-progress --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Archive code coverage results
id: archive-coverage
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
retention-days: 7
path: |
**/target/jacoco-results/jacoco.xml
**/target/jacoco-results/**/*.html
- name: Archive Release
id: archive-release
uses: actions/upload-artifact@v2
with:
name: archive-release
retention-days: 7
path: |
**/target/*.asc
**/target/*.jar
**/target/*.pom
ant/target/*.zip
cli/target/*.zip
target/*.buildinfo
- name: Archive Site
id: archive-site
uses: actions/upload-artifact@v2
with:
name: archive-site
retention-days: 7
path: target/staging/
publish_coverage:
name: publish code coverage reports
runs-on: ubuntu-latest
needs: build
steps:
- name: Download coverage reports
uses: actions/download-artifact@v2
with:
name: code-coverage-report
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: utils/target/jacoco-results/jacoco.xml,core/target/jacoco-results/jacoco.xml,maven/target/jacoco-results/jacoco.xml,ant/target/jacoco-results/jacoco.xml,cli/target/jacoco-results/jacoco.xml
docker:
name: Publish Docker
runs-on: ubuntu-latest
needs: build
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
steps:
- name: Check Maven Cache
id: maven-cache
uses: actions/[email protected]
with:
path: ~/.m2/repository/
key: mvn-repo
- name: Check Docker ODC Cache
id: docker-odc-cache
uses: actions/[email protected]
with:
path: ~/OWASP-Dependency-Check
key: docker-repo
- name: Checkout code
uses: actions/[email protected]
- name: Download release build
uses: actions/download-artifact@v2
with:
name: archive-release
- name: Build Docker Image
run: ./build-docker.sh
- name: build scan target
run: mvn -s settings.xml package -DskipTests=true --no-transfer-progress --batch-mode
- name: Test Docker Image
run: ./test-docker.sh
- name: Deploy Docker Image
run: |
echo $DOCKER_TOKEN | docker login -u $DOCKER_USERNAME --password-stdin 2>/dev/null
./publish-docker.sh
release:
name: Publish Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Get version
id: get-version
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Download release build
uses: actions/download-artifact@v2
with:
name: archive-release
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Version ${{ env.VERSION }}
prerelease: false
draft: false
body: |
Changes in this Release
- Performance improvements for some Maven projects (see #3923 and #3931).
- Fixed bug in npm version handling introduced in 6.5.2 (see #3956).
- Improved the node package analyzer to correctly report the origin of a dependency (see #3970).
- General code maintenance and false positive reductions.
- See the full listing of [changes](https://github.com/jeremylong/DependencyCheck/milestone/39?closed=1).
- name: Upload CLI
id: upload-release-cli
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: cli/target/dependency-check-${{env.VERSION}}-release.zip
asset_name: dependency-check-${{env.VERSION}}-release.zip
asset_content_type: application/zip
- name: Upload CLI signature
id: upload-release-cli-sig
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: cli/target/dependency-check-${{env.VERSION}}-release.zip.asc
asset_name: dependency-check-${{env.VERSION}}-release.zip.asc
asset_content_type: text/plain
- name: Upload ANT
id: upload-release-ant
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ant/target/dependency-check-ant-${{env.VERSION}}-release.zip
asset_name: dependency-check-ant-${{env.VERSION}}-release.zip
asset_content_type: application/zip
- name: Upload ANT signature
id: upload-release-ant-sig
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ant/target/dependency-check-ant-${{env.VERSION}}-release.zip.asc
asset_name: dependency-check-ant-${{env.VERSION}}-release.zip.asc
asset_content_type: text/plain
- name: Upload buildinfo
id: upload-release-buildinfo
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/dependency-check-parent-${{env.VERSION}}.buildinfo
asset_name: dependency-check-parent-${{env.VERSION}}.buildinfo
asset_content_type: text/plain
publish:
name: Publish gh-pages
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Download Site
uses: actions/download-artifact@v2
with:
name: archive-site
path: target/staging
- name: Display structure of downloaded files
run: ls -R
working-directory: target
- name: Deploy gh-pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: target/staging