-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (43 loc) · 1.56 KB
/
Copy pathdeploy-static.yml
File metadata and controls
50 lines (43 loc) · 1.56 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
name: Deploy Static to GitHub Pages
on:
push:
branches:
- master # Support both main and master branch names
workflow_dispatch: # Enable manual triggering via GitHub Actions UI
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install dependencies
run: npm install
- name: Create .env file
run: |
echo "VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }}" > .env
echo "VITE_APP_TITLE=${{ secrets.VITE_APP_TITLE }}" >> .env
echo "VITE_PROXY_PATH=${{ secrets.VITE_PROXY_PATH }}" >> .env
echo "VITE_PROXY_TARGET_URL=${{ secrets.VITE_PROXY_TARGET_URL }}" >> .env
echo "VITE_APP_BASE=/app/" >> .env
echo "=== .env file contents ==="
cat .env
echo "=========================="
- name: Build static assets
run: npm run build:static
env:
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
VITE_APP_TITLE: ${{ secrets.VITE_APP_TITLE }}
VITE_PROXY_PATH: ${{ secrets.VITE_PROXY_PATH }}
VITE_PROXY_TARGET_URL: ${{ secrets.VITE_PROXY_TARGET_URL }}
VITE_APP_BASE: "/app/"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist-static
publish_branch: gh-pages
force_orphan: true