Skip to content

Commit 0db9ddf

Browse files
committed
add github workflow
1 parent 6b868b9 commit 0db9ddf

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

public/github/judge-other.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "online judge"
2+
on:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
judge:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: pku-software/mini-lisp-judge-action@linux

public/github/judge-vs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "online judge"
2+
on:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
judge:
8+
runs-on: windows-latest
9+
steps:
10+
- uses: pku-software/mini-lisp-judge-action@vs

src/generate.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ function getIdeUrls(ide: string, platform: string, tool: string) {
2929
}
3030
}
3131

32+
function getActionUrls(ide: string) {
33+
switch (ide) {
34+
case "vs":
35+
return ["./github/judge-vs.yml"];
36+
default:
37+
return ["./github/judge-other.yml"];
38+
}
39+
}
40+
3241
const IDE_FILES_DEST: Record<string, string> = {
3342
vs: "",
3443
clion: ".idea/",
@@ -153,12 +162,14 @@ export async function generate(ids: string[]) {
153162
const configUrls = [...COMMON_CONFIG_FILES, ...TOOL_CONFIG_FILES[tool]].map(
154163
(f) => `./configs/${f}`
155164
);
165+
const actionUrls = getActionUrls(ide);
156166

157167
const zip = new JSZip();
158168
zip.file("README.md", readme);
159169
await saveFilesFromUrls(zip, srcUrls, srcDest);
160170
await saveFilesFromUrls(zip, ideUrls, ideDest);
161171
await saveFilesFromUrls(zip, configUrls, "");
172+
await saveFilesFromUrls(zip, actionUrls, ".github/workflows/");
162173

163174
const blob = await zip.generateAsync({ type: "blob" });
164175
saveAs("mini_lisp.zip", blob);

0 commit comments

Comments
 (0)