Skip to content

Commit fe17bfe

Browse files
authored
Update deploy-to-master.yml
1 parent 0c7d529 commit fe17bfe

1 file changed

Lines changed: 13 additions & 44 deletions

File tree

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: Deploy Built Project to Master Branch
1+
name: Fast Deploy to Master Branch
22

33
on:
44
push:
55
branches: [ next ]
66
workflow_dispatch:
77

88
jobs:
9-
build-and-deploy:
9+
fast-deploy:
1010
runs-on: ubuntu-latest
1111

1212
steps:
1313
# 1️⃣ Checkout next branch
14-
- name: Checkout
14+
- name: Checkout next branch
1515
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
@@ -29,7 +29,7 @@ jobs:
2929
npm ci
3030
npm install --save-dev terser
3131
32-
# 4️⃣ Create production .env (no NODE_ENV here)
32+
# 4️⃣ Create production .env (no NODE_ENV)
3333
- name: Create production .env
3434
run: |
3535
echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY || '' }}" >> .env.production
@@ -41,15 +41,15 @@ jobs:
4141
echo "VITE_SHOW_TRANSLATION_DEBUG=false" >> .env.production
4242
echo "VITE_SHOW_DEBUG_INFO=false" >> .env.production
4343
44-
# 5️⃣ Build project (Vite production mode via CLI)
44+
# 5️⃣ Build project
4545
- name: Build project
4646
run: npm run build:prod
4747

48-
# 6️⃣ Ensure dist/ exists and prepare deploy directory
49-
- name: Prepare deploy directory
48+
# 6️⃣ Ensure dist exists and prepare deploy folder
49+
- name: Prepare deploy folder
5050
run: |
5151
if [ ! -d dist ]; then
52-
echo "Error: dist/ folder not found. Build may have failed."
52+
echo "Error: dist/ not found. Build failed."
5353
exit 1
5454
fi
5555
mkdir -p deploy
@@ -59,42 +59,11 @@ jobs:
5959
cp README.md deploy/
6060
cp package.json deploy/
6161
62-
# 7️⃣ Discard local changes before switching branches
63-
- name: Discard local changes
64-
run: git reset --hard
65-
66-
# 8️⃣ Checkout master branch
67-
- name: Checkout master branch
68-
run: |
69-
git fetch origin master
70-
git checkout master
71-
git pull origin master
72-
73-
# 9️⃣ Clean master branch except .git
74-
- name: Clean master branch
75-
run: |
76-
find . -maxdepth 1 -not -name '.git' -not -name '.' -exec rm -rf {} +
77-
78-
# 🔟 Copy deploy contents to root
79-
- name: Copy deploy files
80-
run: cp -r deploy/* .
81-
82-
# 1️⃣1️⃣ Configure Git
83-
- name: Configure Git
84-
run: |
85-
git config --local user.email "action@github.com"
86-
git config --local user.name "GitHub Action"
87-
88-
# 1️⃣2️⃣ Commit and push
89-
- name: Commit and push
90-
run: |
91-
git add .
92-
git commit -m "Deploy built project from next branch - $(date)" || echo "No changes to commit"
93-
git push origin master
94-
95-
# 1️⃣3️⃣ Deploy to GitHub Pages
96-
- name: Deploy to GitHub Pages
62+
# 7️⃣ Deploy directly to master branch using GitHub Pages action
63+
- name: Deploy to GitHub Pages (master branch)
9764
uses: peaceiris/actions-gh-pages@v3
9865
with:
9966
github_token: ${{ secrets.GITHUB_TOKEN }}
100-
publish_dir: ./
67+
publish_dir: ./deploy
68+
publish_branch: master
69+
force_orphan: true # replaces entire master content

0 commit comments

Comments
 (0)