-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (79 loc) · 2.42 KB
/
publish.yaml
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
name: Publish NPM
on:
release:
types: [created]
env:
DIST_FOLDER: dist
PACKAGE_NAME_COMMON: ngds-common-components
PACKAGE_NAME_FORMS: ngds-forms
jobs:
package:
name: "Publish to NPM"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
scope: "@digitalspace"
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
### Install if no cache exists ###
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn install --silent --frozen-lockfile
### Build if no cache exists ###
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: |
**/dist
key: ${{ github.sha }}-dist
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: |
yarn build
yarn build $PACKAGE_NAME_FORMS
yarn build $PACKAGE_NAME_COMMON
### Config NPM Credentials
- run: |
git config --global user.email ${{ secrets.EMAIL }}
git config --global user.name ${{ secrets.USERNAME }}
### Publish NGDS-Forms
- run: |
cd $DIST_FOLDER/$PACKAGE_NAME_FORMS
npm version ${{ github.ref_name }}
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
### Publish NGDS-Common-Components
- run: |
cd $DIST_FOLDER/$PACKAGE_NAME_COMMON
npm version ${{ github.ref_name }}
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deploy to Pages
run: |
yarn deploy
- name: Generate 404.html
uses: canastro/copy-file-action@master
with:
source: "dist/ngds-toolkit/index.html"
target: "dist/ngds-toolkit/404.html"
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: dist/ngds-toolkit