Skip to content

Commit befea14

Browse files
Merge remote-tracking branch 'origin/master'
2 parents b5a75f5 + 4db104c commit befea14

File tree

11 files changed

+343
-101
lines changed

11 files changed

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

.github/workflows/ci-build.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
secrets:
20+
registry-0-usr: ${{ secrets.HUB_USERNAME }}
21+
registry-0-psw: ${{ secrets.HUB_ACCESS_TOKEN }}

.github/workflows/ci-release.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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+
outputs:
23+
version: ${{ steps.variables.outputs.version }}
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/[email protected]
27+
28+
- name: Set up NodeJs
29+
uses: actions/[email protected]
30+
with:
31+
node-version: '16'
32+
cache: 'npm'
33+
34+
- name: Setup Environment
35+
id: variables
36+
run: |-
37+
git config user.name "github-actions[bot]"
38+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
40+
npm version ${{ github.event.inputs.version-to-bump }} -m "prepare-release: set version to %s"
41+
42+
git push --tags origin "HEAD:refs/heads/master"
43+
APP_VERSION=`jq -r '.version' package.json`
44+
echo "::set-output name=version::${APP_VERSION}"
45+
46+
call-build:
47+
needs:
48+
- prepare-release
49+
uses: ./.github/workflows/_meta-build.yaml
50+
with:
51+
app-version: ${{ needs.prepare-release.outputs.version }}
52+
secrets:
53+
registry-0-usr: ${{ secrets.HUB_USERNAME }}
54+
registry-0-psw: ${{ secrets.HUB_ACCESS_TOKEN }}
55+
56+
create-release:
57+
runs-on: ubuntu-latest
58+
needs:
59+
- prepare-release
60+
- call-build
61+
62+
env:
63+
VERSION: ${{ needs.prepare-release.outputs.version }}
64+
65+
steps:
66+
- name: Checkout Repository
67+
uses: actions/[email protected]
68+
69+
- name: Set up NodeJs
70+
uses: actions/[email protected]
71+
with:
72+
node-version: '16'
73+
cache: 'npm'
74+
75+
- name: Download Artifacts
76+
uses: actions/[email protected]
77+
with:
78+
name: assembled-frontend-node16
79+
80+
- name: Create Checksums
81+
run: |-
82+
zip -qr frontend-dist.zip dist/*
83+
84+
echo "# SHA1" >> checksums.txt
85+
sha1sum frontend-dist.zip >> checksums.txt
86+
echo "# SHA256" >> checksums.txt
87+
sha256sum frontend-dist.zip >> checksums.txt
88+
echo "# SHA512" >> checksums.txt
89+
sha512sum frontend-dist.zip >> checksums.txt
90+
91+
- name: Create GitHub Release
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
GH_OPTS: ""
95+
run: |-
96+
cat << EOF >> .github/default-release-notes.md
97+
\`\`\`text
98+
$(cat checksums.txt)
99+
\`\`\`
100+
EOF
101+
102+
if [[ "${{ contains(github.event.inputs.version-to-bump, 'pre') }}" == "true" ]]; then
103+
GH_OPTS="--prerelease "
104+
fi
105+
106+
gh release create "${{ needs.prepare-release.outputs.version }}" \
107+
--title "${{ needs.prepare-release.outputs.version }}" \
108+
--notes-file ".github/default-release-notes.md" \
109+
--generate-notes ${GH_OPTS}\
110+
frontend-dist.zip \
111+
checksums.txt \
112+
bom.xml bom.json

.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

.github/workflows/nodejs.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

docker/Dockerfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)