-
Notifications
You must be signed in to change notification settings - Fork 6
84 lines (83 loc) · 3.05 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
name: Create release
on:
workflow_dispatch:
inputs:
version:
description: '⚠ be sure of yourself ⚠'
required: false
default: ''
jobs:
snyk:
runs-on: ubuntu-latest
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
NODE_OPTIONS: --max-old-space-size=8192
GITHUB_CREDENTIALS: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: '16'
- name: Install dependencies
run: |
npm ci
yarn install --no-immutable --mode=skip-build
- name: Snyk Test
run: |
npx snyk monitor --dev --yarn-workspaces --exclude="project.json,npm-shim"
npx snyk test --dev --yarn-workspaces --exclude="project.json,npm-shim"
- name: Snyk Code
continue-on-error: true
run: |
mkdir -p sarifs
npx snyk code test --dev --all-projects --exclude="project.json,npm-shim" --sarif > ./sarifs/snyk-code.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@d5cec099b513fccc2cfcc9247113ecc9edbdacc5 # tag=v1
with:
sarif_file: ./sarifs
- name: Check Code Scanning alerts
run: node ./scripts/get-code-scanning-alerts.js
release:
needs: snyk
environment: 'Release'
runs-on: ubuntu-latest
env:
GITHUB_CREDENTIALS: ${{ secrets.CLI_RELEASE }}
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
with:
# pulls all commits (needed for computing the next version)
fetch-depth: 0
# pulls all tags (needed for computing the next version)
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*``
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
# TODO: CDX-1010 | Remove in CDX-1010.
- run: npm i -g npm@8.10.0
- name: Install dependencies
run: npm ci
- name: Setup credentials
run: |
git config --global user.email action@github.com
git config --global user.name GitHub Action
- name: Setup git SSH remote
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "${DEPLOY_KEY}" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
echo "Host coveo-cli" > ~/.ssh/config
echo "Hostname github.com" >> ~/.ssh/config
echo "PreferredAuthentications publickey" >> ~/.ssh/config
echo -n "IdentityFile " >> ~/.ssh/config
echo -n ~ >> ~/.ssh/config
echo "/.ssh/id_rsa" >> ~/.ssh/config
git remote set-url origin git@coveo-cli:coveo/cli.git
- name: Release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ inputs.version }}