Skip to content

Commit e389b08

Browse files
committed
Update build.yml
1 parent 447d796 commit e389b08

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515

1616
- name: Setup Node.js
1717
uses: actions/setup-node@v4
18+
1819
with:
1920
node-version: 20
2021

@@ -23,25 +24,30 @@ jobs:
2324

2425
- name: Build project
2526
run: npm run build
27+
2628
- name: Run tests
27-
run: ls -a
29+
run: ls
30+
2831
- name: Deploy dist to gh-pages
2932
run: |
3033
# configure git
3134
git config --global user.name "github-actions[bot]"
3235
git config --global user.email "github-actions[bot]@users.noreply.github.com"
3336
34-
# clone gh-pages branch (or create if missing)
37+
# save dist folder temporarily
38+
cp -r ./dist /tmp/dist
39+
40+
# switch to gh-pages branch (or create it)
3541
git fetch origin gh-pages || true
3642
git checkout gh-pages || git checkout --orphan gh-pages
3743
3844
# clear old contents
3945
rm -rf ./*
4046
41-
# copy new build files
42-
cp -r ./dist/* .
47+
# copy dist back
48+
cp -r /tmp/dist/* .
4349
4450
# commit and push
4551
git add -A
4652
git commit -m "Deploy from ${GITHUB_SHA}" || echo "No changes to commit"
47-
git push origin gh-pages
53+
git push origin gh-pages

0 commit comments

Comments
 (0)