-
Notifications
You must be signed in to change notification settings - Fork 460
121 lines (114 loc) · 3.77 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
name: Release to Dockerhub
on:
push:
branches: [master, dev]
paths-ignore:
- '**.md'
- '.github/'
- '.gitignore'
- '.sonarcloud.properties'
- 'provisioning'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- 'Vagrantfile'
jobs:
build:
if: github.event_name != 'pull_request' && github.repository == 'OWASP/SecurityShepherd'
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v3.6.0
with:
distribution: 'zulu'
java-version: '8'
- name: Build Maven with Docker Profile and Generate SBOM
run: mvn clean install -Pdocker -DskipTests -B -DexcludeTestProject=true cyclonedx:makeBom
- name: Upload WAR File
uses: actions/upload-artifact@v3
with:
name: security_shepherd_war
path: target/*.war
- name: Docker Compose Build
run: docker-compose build
- name: Generate Tomcat Docker Image SBOM
uses: anchore/sbom-action@v0
id: tomcat
with:
format: cyclonedx-json
image: owasp/security-shepherd
output-file: ${{ github.workspace }}/target/owasp-security-shepherd-tomcat.cyclonedx.json
- name: Generate MariaDB Docker Image SBOM
uses: anchore/sbom-action@v0
id: mariadb
with:
format: cyclonedx-json
image: owasp/security-shepherd_mariadb
output-file: ${{ github.workspace }}/target/owasp-security-shepherd-mariadb.cyclonedx.json
- name: Generate MongoDB Docker Image SBOM
uses: anchore/sbom-action@v0
id: mongodb
with:
format: cyclonedx-json
image: owasp/security-shepherd_mongo
output-file: ${{ github.workspace }}/target/owasp-security-shepherd-mongodb.cyclonedx.json
- name: Upload SBOMs
uses: actions/upload-artifact@v3
with:
name: security_shepherd_sboms
path: |
target/*.json
target/*.xml
- name: Cache Maven packages
uses: actions/cache@v3
with:
key: maven-output-${{ hashFiles('target/**') }}
path: |
target/
docker/mariadb/target
docker/mongo/target
release-security-shepherd:
needs: build
if: github.event_name != 'pull_request' && github.repository == 'OWASP/SecurityShepherd'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.1.1
with:
images: owasp/security-shepherd
- name: Restore Cached Maven packages
uses: actions/cache@v3
with:
key: maven-output-${{ hashFiles('target/**') }}
path: |
target/
docker/mariadb/target
docker/mongo/target
# Dump the environment variables from the dotenv file so they can be used to build the tomcat server
- name: Set environment variables
uses: c-py/action-dotenv-to-setenv@80f488cda311f44d43e687a4e94f54a050b7822a # v4
with:
env-file: .env
- name: Build and push Tomcat
uses: docker/build-push-action@v3.2.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
TOMCAT_DOCKER_VERSION
TLS_KEYSTORE_FILE
TLS_KEYSTORE_PASS
ALIAS
HTTPS_PORT