-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (47 loc) · 1.4 KB
/
develop-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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Deploy to GitHub Pages (develop)
on:
push:
branches:
- develop
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16' # プロジェクトに合わせてNode.jsのバージョンを指定
- name: Install pnpm
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install # または npm install
- name: Build
run: npm run build # または pnpm run build
- name: Fetch and checkout gh-pages branch
run: |
git fetch origin gh-pages:gh-pages
git checkout gh-pages
- name: Configure Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: (DEBUG) Show git status before changes
run: |
git status
git diff --staged
- name: Commit and push changes
run: |
mkdir -p dev
cp -r dist/* dev/
git add dev
git diff --staged --quiet || git commit -m "Deploy develop branch to /dev directory"
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: (DEBUG) Show git status after changes
run: |
git status
git diff --staged