Skip to content

Commit e602890

Browse files
committed
Merge branch 'master' of https://github.com/AbdelHajou/frontend
2 parents 4e32e8b + 7845d41 commit e602890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3214
-539
lines changed

.github/default-release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Dependency Track Frontend
2+
3+
For official releases, refer to [Dependency Track Docs >> Changelogs](https://docs.dependencytrack.org/changelog/) for information about improvements and upgrade notes.
4+
If additional details are required, consult the closed issues for this release milestone.

.github/workflows/_meta-build.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
node-versions:
5+
type: string
6+
required: false
7+
default: '["16"]'
8+
description: 'Stringified JSON Array of node versions to build against'
9+
node-version-package:
10+
type: string
11+
required: false
12+
default: '16'
13+
description: 'Set which version of node the container packaged dist should be based on. (MUST be part of the node-versions)'
14+
app-version:
15+
type: string
16+
required: false
17+
default: "snapshot"
18+
description: "Set the version that should be set/used as tag for the container image"
19+
publish-container:
20+
type: boolean
21+
required: false
22+
default: false
23+
description: "Set if the container image gets publish and scan once its build"
24+
secrets:
25+
registry-0-usr:
26+
required: true
27+
registry-0-psw:
28+
required: true
29+
30+
jobs:
31+
build-node:
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
fail-fast: true
36+
matrix:
37+
node-version: ${{ fromJson(inputs.node-versions) }}
38+
39+
steps:
40+
- name: Checkout Repository
41+
uses: actions/[email protected]
42+
43+
- name: Set up NodeJs
44+
uses: actions/[email protected]
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
cache: 'npm'
48+
49+
- name: Run Npm Build
50+
env:
51+
CI: true
52+
run: |-
53+
npm ci
54+
npm run build --if-present
55+
56+
- name: Upload Artifacts
57+
uses: actions/[email protected]
58+
with:
59+
name: assembled-frontend-node${{ matrix.node-version }}
60+
path: |-
61+
dist/
62+
bom.*
63+
64+
build-container:
65+
runs-on: ubuntu-latest
66+
needs:
67+
- build-node
68+
69+
steps:
70+
- name: Checkout Repository
71+
uses: actions/[email protected]
72+
73+
- name: Download Artifacts
74+
uses: actions/[email protected]
75+
with:
76+
name: assembled-frontend-node${{ inputs.node-version-package }}
77+
78+
- name: Set up QEMU
79+
uses: docker/[email protected]
80+
81+
- name: Set up Docker Buildx
82+
uses: docker/[email protected]
83+
id: buildx
84+
with:
85+
install: true
86+
87+
- name: Login to Docker.io
88+
uses: docker/[email protected]
89+
if: ${{ inputs.publish-container }}
90+
with:
91+
registry: docker.io
92+
username: ${{ secrets.registry-0-usr }}
93+
password: ${{ secrets.registry-0-psw }}
94+
95+
- name: Set Container Tags
96+
id: tags
97+
run: |-
98+
TAGS="${TAGS},docker.io/dependencytrack/frontend:${{ inputs.app-version }}"
99+
100+
if [[ "${{ inputs.app-version }}" != "snapshot" ]]; then
101+
TAGS="${TAGS},docker.io/dependencytrack/frontend:latest"
102+
fi
103+
echo "::set-output name=tags::${TAGS}"
104+
105+
- name: Build multi-arch Container Image
106+
uses: docker/[email protected]
107+
with:
108+
tags: ${{ steps.tags.outputs.tags }}
109+
build-args: |-
110+
APP_VERSION=${{ inputs.app-version }}
111+
COMMIT_SHA=${{ github.sha }}
112+
platforms: linux/amd64,linux/arm64
113+
push: ${{ inputs.publish-container }}
114+
context: .
115+
file: docker/Dockerfile.alpine
116+
117+
- name: Run Trivy Vulnerability Scanner
118+
if: ${{ inputs.publish-container }}
119+
uses: aquasecurity/[email protected]
120+
with:
121+
image-ref: docker.io/dependencytrack/frontend:${{ inputs.app-version }}
122+
format: 'sarif'
123+
output: 'trivy-results.sarif'
124+
ignore-unfixed: true
125+
vuln-type: 'os'
126+
127+
- name: Upload Trivy Scan Results to GitHub Security Tab
128+
if: ${{ inputs.publish-container }}
129+
uses: github/codeql-action/upload-sarif@v2
130+
with:
131+
sarif_file: 'trivy-results.sarif'

.github/workflows/ci-build.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build CI
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master' # Default branch
7+
pull_request:
8+
branches:
9+
- 'master' # Default branch
10+
workflow_dispatch:
11+
12+
jobs:
13+
call-build:
14+
uses: ./.github/workflows/_meta-build.yaml
15+
with:
16+
node-versions: '["14", "16"]'
17+
node-version-package: '16'
18+
app-version: 'snapshot'
19+
publish-container: ${{ github.ref == 'refs/heads/master' }}
20+
secrets:
21+
registry-0-usr: ${{ secrets.HUB_USERNAME }}
22+
registry-0-psw: ${{ secrets.HUB_ACCESS_TOKEN }}

.github/workflows/ci-publish.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Publish CI
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
workflow_dispatch:
8+
9+
jobs:
10+
read-version:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
version: ${{ steps.parse.outputs.version }}
14+
steps:
15+
- name: Assert ref type
16+
run: |-
17+
if [[ "$GITHUB_REF_TYPE" != "tag" ]]; then
18+
echo "::error::Publishing is only supported for tags!"
19+
exit 1
20+
fi
21+
22+
- name: Checkout Repository
23+
uses: actions/[email protected]
24+
25+
- name: Parse Version from package.json
26+
id: parse
27+
run: |-
28+
VERSION=`jq -r '.version' package.json`
29+
echo "::set-output name=version::${VERSION}"
30+
31+
call-build:
32+
needs:
33+
- read-version
34+
uses: ./.github/workflows/_meta-build.yaml
35+
with:
36+
app-version: ${{ needs.read-version.outputs.version }}
37+
publish-container: true
38+
secrets:
39+
registry-0-usr: ${{ secrets.HUB_USERNAME }}
40+
registry-0-psw: ${{ secrets.HUB_ACCESS_TOKEN }}
41+
42+
update-github-release:
43+
runs-on: ubuntu-latest
44+
needs:
45+
- read-version
46+
- call-build
47+
steps:
48+
- name: Checkout Repository
49+
uses: actions/[email protected]
50+
51+
- name: Download Artifacts
52+
uses: actions/[email protected]
53+
with:
54+
name: assembled-frontend-node16
55+
56+
- name: Create Checksums
57+
run: |-
58+
zip -qr frontend-dist.zip dist/*
59+
60+
echo "# SHA1" >> checksums.txt
61+
sha1sum frontend-dist.zip >> checksums.txt
62+
echo "# SHA256" >> checksums.txt
63+
sha256sum frontend-dist.zip >> checksums.txt
64+
echo "# SHA512" >> checksums.txt
65+
sha512sum frontend-dist.zip >> checksums.txt
66+
67+
- name: Update Release
68+
env:
69+
# or change it to a custom PAT that should be credited for the release
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |-
72+
cat << EOF >> .github/default-release-notes.md
73+
\`\`\`text
74+
$(cat checksums.txt)
75+
\`\`\`
76+
EOF
77+
78+
gh release edit ${{ needs.read-version.outputs.version }} \
79+
--notes-file ".github/default-release-notes.md"
80+
81+
gh release upload ${{ needs.read-version.outputs.version }} \
82+
--clobber \
83+
frontend-dist.zip \
84+
checksums.txt \
85+
bom.xml bom.json

.github/workflows/ci-release.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release CI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version-to-bump:
7+
type: choice
8+
required: true
9+
description: "Select which part of the version to bump and release"
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
- prepatch
15+
- preminor
16+
- premajor
17+
- prerelease
18+
19+
jobs:
20+
prepare-release:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/[email protected]
25+
26+
- name: Set up NodeJs
27+
uses: actions/[email protected]
28+
with:
29+
node-version: '16'
30+
cache: 'npm'
31+
32+
- name: Bump version and tag via NodeJS
33+
# if you use a bot-user to create the release in the next step
34+
# then it might be a solid idea to change the git config values below to the bot-user's name + email
35+
run: |-
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
39+
npm version ${{ github.event.inputs.version-to-bump }} -m "prepare-release: set version to %s"
40+
41+
git push origin "HEAD:refs/heads/master"
42+
43+
- name: Create GitHub Release
44+
env:
45+
# or change it to a custom PAT that should be credited for the release
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
GH_OPTS: ""
48+
run: |-
49+
VERSION=`jq -r '.version' package.json`
50+
51+
if [[ "${{ contains(github.event.inputs.version-to-bump, 'pre') }}" == "true" ]]; then
52+
GH_OPTS="--prerelease"
53+
fi
54+
55+
gh release create "${VERSION}" ${GH_OPTS} \
56+
--title "${VERSION}" \
57+
--notes-file ".github/default-release-notes.md"

.github/workflows/codeql-analysis.yml renamed to .github/workflows/codeql-analysis.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
analyze:
1414
name: Analyze
1515
runs-on: ubuntu-latest
16+
if: ${{ github.repository == 'DependencyTrack/frontend' }}
1617

1718
strategy:
1819
fail-fast: false
@@ -25,7 +26,7 @@ jobs:
2526

2627
steps:
2728
- name: Checkout repository
28-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
2930
with:
3031
# We must fetch at least the immediate parents so that if this is
3132
# a pull request then we can checkout the head.
@@ -42,7 +43,7 @@ jobs:
4243
with:
4344
languages: ${{ matrix.language }}
4445
# If you wish to specify custom queries, you can do so here or in a config file.
45-
# By default, queries listed here will override any specified in a config file.
46+
# By default, queries listed here will override any specified in a config file.
4647
# Prefix the list here with "+" to use these queries and those in the config file.
4748
# queries: ./path/to/local/query, your-org/your-repo/queries@main
4849

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Dependency Review
2+
on:
3+
pull_request:
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
dependency-review:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/[email protected]
14+
15+
- name: Dependency Review
16+
uses: actions/dependency-review-action@v1

0 commit comments

Comments
 (0)