Skip to content

Commit b44d322

Browse files
author
ndthanhdev
committed
chore: update workflow files
1 parent c6d7cb2 commit b44d322

9 files changed

Lines changed: 81 additions & 46 deletions

File tree

.github/workflows/release-dev.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
- main
77

88
jobs:
9-
run-workflow:
10-
name: Run Workflow
9+
release-dev:
10+
name: Release Dev
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v6
@@ -29,9 +29,7 @@ jobs:
2929
- name: Install dependencies
3030
run: yarn install
3131

32-
- name: Run workflow
33-
working-directory: ./etc/scripts/workflows
34-
run: ./release.ts
32+
- run: ./etc/scripts/workflows/release-publish.ts
3533
env:
3634
MODE: dev
3735
GH_TOKEN: ${{ secrets.GH_TOKEN_DEV }}

.github/workflows/release-prod.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
- v*.*.*
77

88
jobs:
9-
run-workflow:
10-
name: Run Workflow
9+
release-prod:
10+
name: Release Prod
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v6
@@ -29,9 +29,7 @@ jobs:
2929
- name: Install dependencies
3030
run: yarn install
3131

32-
- name: Run workflow
33-
working-directory: ./etc/scripts/workflows
34-
run: ./release.ts
32+
- run: ./etc/scripts/workflows/release-publish.ts
3533
env:
3634
MODE: prod
3735
GH_TOKEN: ${{ secrets.GH_TOKEN_PROD }}

.github/workflows/release-stg.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
- release-*
77

88
jobs:
9-
run-workflow:
10-
name: Run Workflow
9+
release-stg:
10+
name: Release Stg
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v6
@@ -29,9 +29,7 @@ jobs:
2929
- name: Install dependencies
3030
run: yarn install
3131

32-
- name: Run workflow
33-
working-directory: ./etc/scripts/workflows
34-
run: ./release.ts
32+
- run: ./etc/scripts/workflows/release-publish.ts
3533
env:
3634
MODE: stg
3735
GH_TOKEN: ${{ secrets.GH_TOKEN_STG }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Workspace Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
workspace-check:
10+
name: Workspace Check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Dagger
18+
uses: dagger/dagger-for-github@v8.2.0
19+
with:
20+
version: v0.20.3
21+
verb: functions
22+
workdir: ./etc/workflow-runtime
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 24
28+
29+
- name: Install dependencies
30+
run: yarn install
31+
32+
- run: ./etc/scripts/workflows/workspace-check.ts
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: Validate PR
1+
name: Workspace Verify
22

33
on:
44
pull_request:
55
branches:
66
- main
77

88
jobs:
9-
run-workflow:
10-
name: Run Workflow
9+
workspace-verify:
10+
name: Workspace Verify
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v6
@@ -29,6 +29,4 @@ jobs:
2929
- name: Install dependencies
3030
run: yarn install
3131

32-
- name: Run workflow
33-
working-directory: ./etc/scripts/workflows
34-
run: ./validate-pr.ts
32+
- run: ./etc/scripts/workflows/workspace-verify.ts

etc/scripts/utils/clean-build.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#!/usr/bin/env -S yarn dlx tsx
22
import "zx/globals";
3+
import fse from "fs-extra";
34

4-
import { cleanBuild } from "../utils/clean-build";
55
import { workDirs } from "../utils/work-dirs";
66

77
$.verbose = true;
88

9-
await cleanBuild();
9+
await fse.emptyDir(workDirs.apps.app.public.path);
1010

1111
cd(workDirs.etc.workflowRuntime.path);
1212

13+
const mode = $.env.MODE ?? "dev";
14+
1315
await $`${[
1416
"dagger",
1517
"call",
@@ -20,7 +22,7 @@ await $`${[
2022
"--name",
2123
"MODE",
2224
"--value",
23-
$.env.MODE ?? "dev",
25+
mode,
2426
"with-secret-variable",
2527
"--name",
2628
"GH_TOKEN",
@@ -34,9 +36,7 @@ await $`${[
3436
"scripts:publish",
3537
"container",
3638
"directory",
37-
"--path",
38-
"/workspace/apps/app/public",
39+
"--path=/workspace/apps/app/public",
3940
"export",
40-
"--path",
41-
workDirs.apps.app.public.path,
41+
`--path=${workDirs.apps.app.public.path}`,
4242
]}`;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#!/usr/bin/env -S yarn dlx tsx
22
import "zx/globals";
33

4-
import { cleanBuild } from "../utils/clean-build";
54
import { workDirs } from "../utils/work-dirs";
65

76
$.verbose = true;
87

9-
await cleanBuild();
10-
118
cd(workDirs.etc.workflowRuntime.path);
129

1310
await $`${[
@@ -21,11 +18,9 @@ await $`${[
2118
"MODE",
2219
"--value",
2320
"dev",
24-
"with-moon-task",
25-
"--task",
26-
"scripts:test",
27-
"with-moon-task",
28-
"--task",
29-
"scripts:build",
21+
"with-moon-command",
22+
"--command",
23+
"check",
24+
"--args=--all",
3025
"stdout",
3126
]}`;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env -S yarn dlx tsx
2+
import "zx/globals";
3+
4+
import { workDirs } from "../utils/work-dirs";
5+
6+
$.verbose = true;
7+
8+
cd(workDirs.etc.workflowRuntime.path);
9+
10+
await $`${[
11+
"dagger",
12+
"call",
13+
"--dir",
14+
workDirs.path,
15+
"build-env",
16+
"with-env-variable",
17+
"--name",
18+
"MODE",
19+
"--value",
20+
"dev",
21+
"with-moon-command",
22+
"--command",
23+
"ci",
24+
"stdout",
25+
]}`;

0 commit comments

Comments
 (0)