Skip to content

Commit efdad73

Browse files
committed
feat: add build-workflow
1 parent b045da2 commit efdad73

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { jsCategoryState } from 'src/states/categories';
2+
import { defaultConfig } from './config/default.config';
3+
4+
export const [getConfig] = jsCategoryState.useConfigState({
5+
default: defaultConfig,
6+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const WORKFLOW_FILENAME = 'build.yml';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { addGithubWorkflow } from 'src/utils/github';
2+
import { getConfig } from './build-workflow.config';
3+
import { WORKFLOW_FILENAME } from './build-workflow.const';
4+
5+
export const buildWorkflow = async () => {
6+
const { content } = getConfig();
7+
8+
await addGithubWorkflow(WORKFLOW_FILENAME, content);
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { readableMultilineString } from 'src/utils/string';
2+
3+
const content = readableMultilineString`
4+
name: build
5+
6+
on: push
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Install node
15+
uses: actions/setup-node@v2
16+
with:
17+
cache: "npm"
18+
- name: Install dependencies
19+
run: npm i
20+
- name: Run build
21+
run: npm run build
22+
`;
23+
24+
export const defaultConfig = {
25+
content,
26+
};

src/categories/js/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { releaseWorkflow } from './release-workflow/release-worflow.entrypoint';
99
import { jestEntrypoint } from './jest/jest.entrypoint';
1010
import { testWorkflow } from './test-workflow/test-workflow.entrypoint';
1111
import { codeQlWorkflow } from './codeql-workflow/codeql-workflow.entrypoint';
12+
import { buildWorkflow } from './build-workflow/build-workflow.entrypoint';
1213

1314
// order have matter
1415
const options = {
@@ -23,6 +24,7 @@ const options = {
2324
jest: jestEntrypoint,
2425
testWorkflow,
2526
codeQlWorkflow,
27+
buildWorkflow,
2628
};
2729

2830
export default {

0 commit comments

Comments
 (0)