-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (83 loc) · 2.38 KB
/
build-deploy.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build and Deploy
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
# Framework Build
- name: Install Framework Dependencies
run: |
npm ci
npm run clean || true
env:
NODE_OPTIONS: --experimental-vm-modules
- name: Lint
run: npm run lint || echo "Linting skipped"
env:
NODE_OPTIONS: --experimental-vm-modules
- name: Build Framework
run: npm run build
env:
NODE_OPTIONS: --experimental-vm-modules
# Website Build
- name: Install Website Dependencies
working-directory: website
run: npm ci || echo "No website dependencies to install"
- name: Build Website
working-directory: website
run: npm run build || echo "No website build script"
env:
NODE_ENV: production
- name: Run Tests
run: npm test || echo "No tests to run"
env:
NODE_OPTIONS: --experimental-vm-modules
- name: Deploy Website to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: website/dist
clean: true
publish:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip-publish]')
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
run: |
npm ci
npm run clean || true
env:
NODE_OPTIONS: --experimental-vm-modules
- name: Build
run: npm run build
env:
NODE_OPTIONS: --experimental-vm-modules
- name: Publish to NPM
if: success()
run: |
if [ -z "$(npm view velocityfx versions)" ] || [ "$(npm view velocityfx version)" != "$(node -p "require('./package.json').version")" ]; then
npm publish
else
echo "Current version is already published"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_OPTIONS: --experimental-vm-modules