Skip to content

Commit 6964c7c

Browse files
authored
Fix deploy and check-build workflow (#21)
* test * make 2 workflow consistent * add more info to README
1 parent e38f1ac commit 6964c7c

3 files changed

Lines changed: 19 additions & 43 deletions

File tree

.github/workflows/check-build.yml

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,6 @@ jobs:
3434
path: likec4_src
3535
output: public/images/likec4
3636

37-
- name: Detect package manager
38-
id: detect-package-manager
39-
run: |
40-
if [ -f "./yarn.lock" ]; then
41-
echo "manager=yarn" >> $GITHUB_OUTPUT
42-
echo "command=install" >> $GITHUB_OUTPUT
43-
echo "runner=yarn" >> $GITHUB_OUTPUT
44-
exit 0
45-
elif [ -f "./package.json" ]; then
46-
echo "manager=npm" >> $GITHUB_OUTPUT
47-
echo "command=ci" >> $GITHUB_OUTPUT
48-
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
49-
exit 0
50-
else
51-
echo "Unable to determine package manager"
52-
exit 1
53-
fi
54-
5537
- name: Setup Node
5638
uses: actions/setup-node@v5
5739
with:
@@ -65,24 +47,12 @@ jobs:
6547
with:
6648
path: |
6749
.next/cache
68-
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
50+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
6951
restore-keys: |
70-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
52+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
7153
7254
- name: Install dependencies
73-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
74-
working-directory: .
75-
76-
- name: Build with Next.js
77-
run: ${{ steps.detect-package-manager.outputs.runner }} next build
78-
working-directory: .
55+
run: npm ci
7956

80-
- name: Copy built files to docs
81-
run: |
82-
rm -rf docs/*
83-
cp -r ./out docs/
84-
85-
- name: Upload artifact
86-
uses: actions/upload-pages-artifact@v5
87-
with:
88-
path: docs
57+
- name: Check build
58+
run: npm run build

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,40 @@ npm run dev
1010

1111
Open [http://localhost:3000](http://localhost:3000) with your browser to see the docs site.
1212

13-
**LikeC4 Development**
13+
### LikeC4 Development
1414

15-
If you encounter 404 errors on the C4 diagrams, try running the following command to generate the images:
15+
- If you encounter 404 errors on the C4 diagrams, try running the following command to generate the images:
1616

1717
```bash
1818
npm run likec4:export
1919
```
2020

21-
The images will be exported to the `public/images/likec4` directory.
21+
It will try to install `playwright` if it's not already installed before exporting the images. The images will be exported to the `public/images/likec4` directory.
2222

23-
If you are developing the likeC4 code, you can run the following command to start the likeC4 development server (localhost:5173):
23+
- If you are developing the likeC4 code, you can run the following command to start the likeC4 development server (localhost:5173):
2424

2525
```bash
2626
npm run likec4:dev
2727
```
2828

2929
Edit the source code in the likec4_src directory and then the images will be updated automatically.
3030

31-
NOTE: You can edit the positions/layout of the components of likeC4 diagrams using the web browser. The modifications will be saved in the `/likec4_src/.likec4` directory as `snap` files. Just keep them and export the images again to see the changes in the docs site.
31+
**NOTE**: You can edit the positions/layout of the components of likeC4 diagrams using the web browser. The modifications will be saved in the `/likec4_src/.likec4` directory as `snap` files. Just keep them and export the images again to see the changes in the docs site.
3232

33-
To export the images to see them in the docs
33+
- To export the images to see them in the docs, run the following command:
3434

3535
```bash
3636
npm run likec4:export
3737
```
3838

39-
**Enable Search on Dev**
39+
- Before building the docs site locally (`npm run build`), make sure to run the following commands to generate LikeC4 React code and export the images first:
40+
41+
```bash
42+
npm run likec4:codegen
43+
npm run likec4:export
44+
```
45+
46+
### Enable Search on Dev
4047

4148
To enable/test search functionality on development server, run the following command:
4249

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dev": "next --turbopack",
77
"predev": "npm run likec4:codegen",
88
"build": "next build",
9-
"prebuild": "npm run likec4:codegen",
109
"start": "npx serve out",
1110
"lint": "eslint",
1211
"postbuild": "pagefind --site .next/server/app --output-path out/_pagefind",

0 commit comments

Comments
 (0)