forked from finos/legend-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (38 loc) · 1.61 KB
/
manual__publish-npm-snapshot.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
name: (Manual) Publish NPM Snapshot
on: workflow_dispatch
jobs:
npm-publish-library-snapshots:
# There is currently no way to limit workflow dispatch to only allow default branch
# so we need to restrict it here
# See https://github.community/t/limit-branch-for-workflow-dispatch/122099
if: github.ref == 'refs/heads/master' && github.repository == 'finos/legend-studio'
name: Publish Snapshots to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Setup Yarn cache
uses: actions/cache@v3.3.1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Setup Node
uses: actions/setup-node@v3.7.0
with:
node-version: 16
# The registry URL and `NODE_AUTH_TOKEN` are needed for `npm publish` to work properly
# See https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn
- name: Publish to NPM
run: yarn build && yarn publish:snapshot
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Webpack build could consume a large amount of memory
NODE_OPTIONS: '--max_old_space_size=4096'