Repository navigation
129 lines (111 loc) · 3.32 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (111 loc) · 3.32 KB
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
name: release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+\-?*'
permissions:
contents: read
jobs:
build:
name: Build with npm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
- name: Cache node modules
uses: actions/cache@v5
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build with npm
run: npm run build
- name: Prepare release SBOM
run: |
cp dist/cyclonedx/bom.json "soarca-gui-${GITHUB_REF_NAME}.cdx.json"
zip sbom.zip "soarca-gui-${GITHUB_REF_NAME}.cdx.json"
- name: Upload SBOM artifact
uses: actions/upload-artifact@v6
with:
name: release-sbom
path: sbom.zip
if-no-files-found: error
retention-days: 1
docker-build:
needs: build
name: Build Docker image and push it to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Get version
run: |
echo "describe_version=$(git describe --tags --dirty)" >> "$GITHUB_ENV"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
build-args: |
VITE_APP_VERSION=${{ env.describe_version }}
push: true
target: production
tags: |
cossas/soarca-gui:${{ env.describe_version }}
cossas/soarca-gui:latest
publish-sbom:
needs: build
name: Publish SBOM to the GitHub release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download SBOM artifact
uses: actions/download-artifact@v7
with:
name: release-sbom
- name: Create GitHub release and publish SBOM
env:
GH_TOKEN: ${{ github.token }}
run: |
if ! gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
if [[ "$GITHUB_REF_NAME" == *-* ]]; then
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--verify-tag \
--generate-notes \
--prerelease \
--title "$GITHUB_REF_NAME"
else
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--verify-tag \
--generate-notes \
--title "$GITHUB_REF_NAME"
fi
fi
gh release upload "$GITHUB_REF_NAME" \
sbom.zip \
--clobber \
--repo "$GITHUB_REPOSITORY"