-
Notifications
You must be signed in to change notification settings - Fork 20
51 lines (43 loc) · 1.47 KB
/
nightly-publish-to-npm.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
name: Nightly Publish Package to NPM
on:
schedule:
- cron: '0 5 * * 1-5'
jobs:
deploy-to-npm:
runs-on: ubuntu-latest
environment: CD
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
always-auth: true
- name: Setup Cognite CICD
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install NPM dependencies
working-directory: viewer
run: yarn install --immutable
- name: Get nightly version
working-directory: viewer
run: echo "NIGHTLY_VERSION=$(jq -r .version ./package.json | echo $(grep -oP '([0-9]+.[0-9]+.[0-9]+)') | echo $(< /dev/stdin)-dev.$(date +'%Y%m%d'))" >> $GITHUB_ENV
- name: Set nightly version
working-directory: viewer
run: npm version ${{ env.NIGHTLY_VERSION }}
- name: Build production version
working-directory: viewer
run: yarn run build:prod
- name: Publish to NPM
working-directory: viewer
run: npm publish --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}