-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (37 loc) · 1.2 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
name: Deploy
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14.17.6
- name: Install dependencies
run: npm install
- name: Build site
run: |
npm run build:prefixed
echo Build site step complete
- name: Deploy to GitHub pages
# only when pushing to main
if: ${{(github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.ref_name == 'main'}}
run: |
cd ./public
git config --global init.defaultBranch main
git init
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
git add .
git commit -m "chore: Deploy commit ${{ github.sha }}"
git push -f https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git main:gh-pages
echo Deploy to GitHub pages site step complete 🚀