Skip to content

Commit 4997ea6

Browse files
authored
update merge to master action (#28)
1 parent 156ec4a commit 4997ea6

File tree

1 file changed

+227
-16
lines changed

1 file changed

+227
-16
lines changed

.github/workflows/MERGE_MASTER.yml

Lines changed: 227 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ on:
66
push:
77
branches:
88
- master
9-
schedule:
10-
- cron: '0 5 * * *'
9+
10+
concurrency:
11+
group: ${{ github.head_ref }}
12+
cancel-in-progress: true
13+
1114
env:
1215
DIRECT_DATABASE_URL: ${{secrets.DIRECT_DATABASE_URL}}
1316
DATABASE_URL: ${{secrets.DATABASE_URL}}
@@ -18,7 +21,6 @@ env:
1821
ENVIRONMENT: ${{secrets.ENVIRONMENT}}
1922
CLOUDFLARE_ACCOUNT_ID: ${{secrets.CLOUDFLARE_ACCOUNT_ID}}
2023
CLOUDFLARE_API_TOKEN: ${{secrets.CLOUDFLARE_API_TOKEN}}
21-
2224
jobs:
2325
INSTALL:
2426
name: Install Dependencies
@@ -27,51 +29,260 @@ jobs:
2729
- uses: actions/checkout@v4
2830
- uses: pnpm/action-setup@v3
2931
with:
30-
version: 9.1.1
32+
version: 9.12.1
3133
- uses: actions/setup-node@v3
3234
with:
33-
node-version: '20'
35+
node-version: '22.9.0'
3436
- uses: actions/cache@v3
3537
id: cache-pnpm
3638
with:
3739
path: ./node_modules
38-
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', './prisma/dev.schema.prisma', './prisma/prod.schema.prisma') }}
40+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
3941
- name: Install
4042
if: steps.cache-pnpm.outputs.cache-hit != 'true'
4143
run: |
4244
pnpm i --frozen-lockfile
43-
pnpm prisma:gen:ci
44-
PUBLISH:
45-
name: Publish to Production
46-
environment: PRODUCTION
45+
pnpm sync
46+
LINT:
47+
name: Lint
4748
runs-on: ubuntu-latest
4849
needs: INSTALL
4950
steps:
5051
- uses: actions/checkout@v4
5152
- uses: pnpm/action-setup@v3
5253
with:
53-
version: 9.1.1
54+
version: 9.12.1
55+
- uses: actions/setup-node@v3
56+
with:
57+
node-version: '22.9.0'
5458
- uses: actions/cache@v3
5559
with:
5660
path: ./node_modules
57-
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', './prisma/dev.schema.prisma', './prisma/prod.schema.prisma') }}
61+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
62+
- name: Install Module Packages
63+
run: |
64+
pnpm i --frozen-lockfile
65+
pnpm sync
66+
- name: Lint
67+
run: |
68+
pnpm lint
69+
VERIFY:
70+
name: Verify
71+
runs-on: ubuntu-latest
72+
needs: INSTALL
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: pnpm/action-setup@v3
76+
with:
77+
version: 9.12.1
78+
- uses: actions/setup-node@v3
79+
with:
80+
node-version: '22.9.0'
81+
- uses: actions/cache@v3
82+
with:
83+
path: ./node_modules
84+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
85+
- name: Install Module Packages
86+
run: |
87+
pnpm i --frozen-lockfile
88+
pnpm sync
89+
- name: Check
90+
run: |
91+
pnpm check
92+
UNIT_TEST:
93+
name: Unit Tests
94+
runs-on: ubuntu-latest
95+
needs: INSTALL
96+
steps:
97+
- uses: actions/checkout@v4
98+
- uses: pnpm/action-setup@v3
99+
with:
100+
version: 9.12.1
101+
- uses: actions/setup-node@v3
102+
with:
103+
node-version: '22.9.0'
104+
- uses: actions/cache@v3
105+
with:
106+
path: ./node_modules
107+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
108+
- name: Install Module Packages
109+
run: |
110+
pnpm i --frozen-lockfile
111+
pnpm sync
112+
- name: Unit Test
113+
run: |
114+
pnpm test
115+
116+
################ PUBLISH #################
117+
PUBLISH_WEBAPP:
118+
name: Publish WebApp
119+
environment: PREVIEW
120+
runs-on: ubuntu-latest
121+
needs: [INSTALL, LINT, VERIFY, UNIT_TEST]
122+
steps:
123+
- uses: actions/checkout@v4
124+
- uses: pnpm/action-setup@v3
125+
with:
126+
version: 9.12.1
127+
- uses: actions/setup-node@v3
128+
with:
129+
node-version: '22.9.0'
130+
- uses: actions/cache@v3
131+
with:
132+
path: ./node_modules
133+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
134+
- name: Install Module Packages
135+
run: |
136+
pnpm i --frozen-lockfile
137+
pnpm sync
58138
- name: Build
59139
env:
60140
IS_CI: false
61141
run: |
62-
pnpm build:prod
63-
- name: Publish to Cloudflare Pages
142+
pnpm turbo @cloudkit/web#build
143+
- name: Publish
64144
uses: cloudflare/pages-action@v1
65145
with:
66146
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
67147
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
68148
projectName: cloudkit
149+
workingDirectory: ./apps/web/
69150
directory: ./.svelte-kit/cloudflare
70151
# Optional: Enable this if you want to have GitHub Deployments triggered
152+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
71153
# Optional: Switch what branch you are publishing to.
72154
# By default this will be the branch which triggered this workflow
73-
# branch: master
155+
branch: ${{ github.head_ref }}
74156
# Optional: Change the working directory
75-
# workingDirectory: my-site
76157
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
77158
wranglerVersion: '3'
159+
PUBLISH_STORYBOOK:
160+
name: Publish Storybook
161+
environment: PREVIEW
162+
runs-on: ubuntu-latest
163+
needs: [INSTALL, LINT, VERIFY, UNIT_TEST]
164+
steps:
165+
- uses: actions/checkout@v4
166+
- uses: pnpm/action-setup@v3
167+
with:
168+
version: 9.12.1
169+
- uses: actions/setup-node@v3
170+
with:
171+
node-version: '22.9.0'
172+
- uses: actions/cache@v3
173+
with:
174+
path: ./node_modules
175+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
176+
- name: Install Module Packages
177+
run: |
178+
pnpm i --frozen-lockfile
179+
pnpm sync
180+
- name: Build
181+
env:
182+
IS_CI: false
183+
run: |
184+
pnpm turbo run @cloudkit/styleguide#build
185+
- name: Publish
186+
uses: cloudflare/pages-action@v1
187+
with:
188+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
189+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
190+
projectName: cloudkit-styleguide
191+
workingDirectory: ./apps/styleguide/
192+
directory: ./storybook-static
193+
# Optional: Enable this if you want to have GitHub Deployments triggered
194+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
195+
# Optional: Switch what branch you are publishing to.
196+
# By default this will be the branch which triggered this workflow
197+
branch: ${{ github.head_ref }}
198+
# Optional: Change the working directory
199+
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
200+
wranglerVersion: '3'
201+
202+
PUBLISH_SWAGGER:
203+
name: Publish Swagger UI
204+
environment: PREVIEW
205+
runs-on: ubuntu-latest
206+
needs: [INSTALL, LINT, VERIFY, UNIT_TEST]
207+
steps:
208+
- uses: actions/checkout@v4
209+
- uses: pnpm/action-setup@v3
210+
with:
211+
version: 9.12.1
212+
- uses: actions/setup-node@v3
213+
with:
214+
node-version: '22.9.0'
215+
- uses: actions/cache@v3
216+
with:
217+
path: ./node_modules
218+
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc') }}
219+
- name: Install Module Packages
220+
run: |
221+
pnpm i --frozen-lockfile
222+
pnpm sync
223+
- name: Build
224+
env:
225+
IS_CI: false
226+
run: |
227+
pnpm turbo run @cloudkit/swagger-ui#build
228+
- name: Publish
229+
uses: cloudflare/pages-action@v1
230+
with:
231+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
232+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
233+
projectName: cloudkit-api
234+
workingDirectory: ./apps/swagger-ui/
235+
directory: ./.svelte-kit/cloudflare
236+
# Optional: Enable this if you want to have GitHub Deployments triggered
237+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
238+
# Optional: Switch what branch you are publishing to.
239+
# By default this will be the branch which triggered this workflow
240+
branch: ${{ github.head_ref }}
241+
# Optional: Change the working directory
242+
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
243+
wranglerVersion: '3'
244+
245+
246+
# Disable until I can figure out a way to deal with the flaky tests
247+
# E2E_TEST:
248+
# name: Run E2E Tests
249+
# needs: [INSTALL]
250+
# runs-on: ubuntu-latest
251+
# steps:
252+
# - name: Setup FFmpeg
253+
# uses: AnimMouse/setup-ffmpeg@v1
254+
# - uses: actions/checkout@v4
255+
# - name: Set up Services
256+
# run: |
257+
# sudo docker-compose up -d
258+
# - uses: pnpm/action-setup@v3
259+
# with:
260+
# version: 9.12.1
261+
# - uses: actions/setup-node@v3
262+
# with:
263+
# node-version: '22.9.0'
264+
# cache: 'pnpm'
265+
# - uses: actions/cache@v3
266+
# with:
267+
# path: ./node_modules
268+
# key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml', '/.npmrc) }}
269+
# - name: Prisma Generate
270+
# run: |
271+
# pnpm prisma:gen:dev
272+
# - name: Prisma Push
273+
# run: |
274+
# pnpm prisma:push:dev
275+
# - name: Install Playwright Browsers
276+
# run: |
277+
# pnpm exec playwright install
278+
# pnpm playwright install-deps chromium
279+
# - name: e2e Test
280+
# run: |
281+
# pnpm run test:e2e:ci
282+
# - uses: actions/upload-artifact@v4
283+
# if: ${{ !cancelled() }}
284+
# with:
285+
# name: playwright-report
286+
# path: test-results/
287+
# retention-days: 5
288+

0 commit comments

Comments
 (0)