Skip to content

Commit 7a8f852

Browse files
ci: rework ci/cd (#59)
* ci: rework ci/cd - Split CI & CD workflow - Add CodeQL - Add Dependency Review - Prepare CD for GitHub Environment (improve secret security) * Update .github/workflows/cd.yml
1 parent 1e9f83a commit 7a8f852

File tree

5 files changed

+82
-9
lines changed

5 files changed

+82
-9
lines changed

.github/workflows/cd.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CD
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
jobs:
7+
cd:
8+
name: CD
9+
runs-on: ubuntu-latest
10+
environment: CD
11+
steps:
12+
- uses: actions/setup-node@v3
13+
with:
14+
registry-url: "https://registry.npmjs.org"
15+
node-version-file: '.nvmrc'
16+
cache: 'npm'
17+
- run: npm ci
18+
- run: npm run build
19+
- run: npm test
20+
- run: npm publish
21+
env:
22+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23+

.github/workflows/ci.yml

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
name: ci
2-
on: push
1+
name: CI
2+
on:
3+
pull_request:
4+
branches: [main]
5+
types: [opened, edited, synchronize, reopened]
6+
push:
7+
branches: [main]
38
jobs:
4-
ci:
9+
CI:
510
runs-on: ubuntu-latest
11+
name: CI
612
steps:
713
- uses: actions/checkout@v3
814
- uses: actions/setup-node@v3
915
with:
1016
node-version-file: '.nvmrc'
17+
cache: 'npm'
1118
- run: npm ci
1219
- run: npm run build
13-
- run: npm run test
14-
- if: startsWith(github.ref, 'refs/tags/v')
15-
run: npm publish
16-
env:
17-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20+
- run: npm run test
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Dependency Review"
2+
on:
3+
pull_request:
4+
branches: ["main"]
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
dependency-Review:
11+
uses: coveo/public-actions/.github/workflows/dependency-review.yml@main
12+
with:
13+
public: true
14+
distributed: true

.github/workflows/security-scan.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Security Scan"
2+
3+
on:
4+
schedule:
5+
- cron: "17 2 * * 2"
6+
workflow_run:
7+
workflows:
8+
- CD
9+
types:
10+
- completed
11+
pull_request:
12+
branches: [main]
13+
types: [opened, edited, synchronize, reopened]
14+
15+
jobs:
16+
codeql:
17+
name: CodeQL
18+
runs-on: ubuntu-latest
19+
permissions:
20+
actions: read
21+
contents: read
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language: ["javascript"]
28+
29+
steps:
30+
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3
31+
- name: CodeQL
32+
uses: ./.github/actions/codeql
33+
with:
34+
language: ${{ matrix.language }}

.npmrc

-1
This file was deleted.

0 commit comments

Comments
 (0)