-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.2 KB
/
Copy pathdeploy-to-master.yml
File metadata and controls
69 lines (59 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Ultra-Fast Deploy to Master Branch
on:
push:
branches: [ next ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1️⃣ Checkout next branch
- name: Checkout next branch
uses: actions/checkout@v4
with:
fetch-depth: 0
# 2️⃣ Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
# 3️⃣ Install dependencies including terser
- name: Install dependencies
run: |
npm ci
npm install --save-dev terser
# 4️⃣ Build + create .env + prepare deploy folder (all in one)
- name: Build project and prepare deploy folder
run: |
# Create production .env
echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY || '' }}" > .env.production
echo "VITE_ENABLE_CHATBOT=${{ secrets.VITE_ENABLE_CHATBOT || 'false' }}" >> .env.production
echo "VITE_ENABLE_DYNAMIC_CONTENT=${{ secrets.VITE_ENABLE_DYNAMIC_CONTENT || 'false' }}" >> .env.production
echo "VITE_SHOW_DEV_ELEMENTS=false" >> .env.production
echo "VITE_SHOW_VISITOR_CONTROLS=false" >> .env.production
echo "VITE_SHOW_PROFILE_INSIGHTS=false" >> .env.production
echo "VITE_SHOW_TRANSLATION_DEBUG=false" >> .env.production
echo "VITE_SHOW_DEBUG_INFO=false" >> .env.production
# Build project in production mode
npm run build:prod
# Ensure dist exists
if [ ! -d dist ]; then
echo "Error: dist/ folder not found. Build failed."
exit 1
fi
# Prepare deploy folder
mkdir -p deploy
cp -r dist/* deploy/
cp .env.production deploy/
cp .env.example deploy/
cp README.md deploy/
cp package.json deploy/
# 5️⃣ Deploy directly to master branch
- name: Deploy to GitHub Pages (master branch)
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
publish_branch: master
force_orphan: true # completely replaces master content