-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (134 loc) · 5.07 KB
/
publish-beta.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Hawa CI - @beta
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_PUBLISH_TAG: next # Specify the tag for publishing (make sure to change it in the append -beta as well)
NODE_VERSION: "21.x"
PM2_PATH: /www/server/nvm/versions/node/v20.11.0/bin/pm2
PNPM_PATH: /www/server/nodejs/v20.11.0/bin/pnpm
PROJECT_PATH: /var/www/html/a01-runner/_work/Hawa/Hawa
STORYBOOK_DOMAIN: storybook.hawa.style
STORYBOOK_SERVER_DIR: hawa-storybook
STORYBOOK_PM2: hawa-storybook
DOCS_DOMAIN: hawa.style
DOCS_SERVER_DIR: hawa-docs
DOCS_PM2: hawa-docs
on:
push:
branches: [main]
paths:
- "apps/docs/**"
- "packages/storybook/**"
- "packages/components/**"
jobs:
check_changes:
runs-on: [self-hosted, linux, x64, A01]
name: "Detecting Changes"
outputs:
storybook_changed: ${{ steps.filter.outputs.storybook }}
docs_changed: ${{ steps.filter.outputs.docs }}
package_changed: ${{ steps.filter.outputs.publish-package }}
steps:
- uses: actions/checkout@v4
with:
clean: false
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
publish-package:
- "packages/components/**"
storybook:
- "packages/storybook/**"
- "packages/components/**"
docs:
- "apps/docs/**"
# =====================================================================================
# ============================= HAWA STORYBOOK ========================================
# =====================================================================================
storybook:
needs: check_changes
name: "Deploy Storybook"
if: needs.check_changes.outputs.storybook_changed == 'true'
runs-on: [self-hosted, linux, x64, A01]
steps:
- uses: actions/checkout@v4
with:
clean: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Dependencies and Build ${{env.STORYBOOK_PM2}}
run: |
pnpm install
pnpm build:lib
cd packages/storybook
npm run build-storybook
# - name: Link to Production and Restart with PM2
# run: |
# cd frontend/pukla-portal
# if pm2 list | grep -q ${{env.PUKLA_PM2}}; then
# pm2 restart ${{env.PUKLA_PM2}}
# else
# pm2 start npm --name ${{env.PUKLA_PM2}} -- run start
# fi
# pm2 save
- name: Display Deployment URL
run: echo "Hawa Storybook deployed successfully at https://${{ env.STORYBOOK_DOMAIN }}"
# =====================================================================================
# ============================= HAWA DOCS =============================================
# =====================================================================================
docs:
needs: check_changes
name: "Deploy Docs"
if: needs.check_changes.outputs.docs_changed == 'true'
runs-on: [self-hosted, linux, x64, A01]
steps:
- uses: actions/checkout@v4
with:
clean: false
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Dependencies and Build beta-user-portal
run: |
pnpm install --filter hawa-docs
cd apps/docs
npm run sync:changelog
npm run build
- name: Link to Production and Restart with PM2
run: |
cd apps/docs
if pm2 list | grep -q ${{env.DOCS_PM2}}; then
pm2 restart ${{env.DOCS_PM2}}
else
pm2 start npm --name ${{env.DOCS_PM2}} -- run start
fi
pm2 save
- name: Display Deployment URL
run: echo "Hawa docs deployed successfully at https://${{ env.DOCS_DOMAIN }}"
publish-package:
if: ${{!contains(github.event.head_commit.message, 'skip_publish')}} && needs.check_changes.outputs.package_changed == 'true'
runs-on: [self-hosted, linux, x64, A01]
steps:
- uses: actions/checkout@v4
- name: Append -next to package.json version
run: |
node -e "const fs = require('fs'); const packageJson = require('./packages/components/package.json'); packageJson.version += '-next'; fs.writeFileSync('./packages/components/package.json', JSON.stringify(packageJson, null, 2));"
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v2
with:
version: 8.14.0
run_install: false
- name: Install dependencies
run: pnpm install
- name: Build Library
run: pnpm run build:lib
- name: Publish to NPM @next tag
run: pnpm --filter @sikka/hawa publish --no-git-checks --tag $NPM_PUBLISH_TAG # Specify the tag here