-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (32 loc) · 1.11 KB
/
deploy.yml
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
name: Deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Update Node.js to the latest stable version
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Set the GitHub API Token as an environment variable for React build
- name: Set GitHub API Token
run: echo "REACT_APP_STATS_API_TOKEN=${{ secrets.STATS_API_TOKEN }}" >> $GITHUB_ENV
# Step 5: Build the React application
- name: Build the project
run: npm run build
# Step 6: Deploy the built files to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }} # Use personal_token for deployment
publish_dir: ./build