-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (46 loc) · 1.51 KB
/
deploy_github_pages.yml
File metadata and controls
53 lines (46 loc) · 1.51 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
name: PUBLISH TO GITHUB PAGES
on:
push:
branches:
- main
# ここでワークフローに書き込み権限を与える
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: write
env:
VITE_API_ENDPOINT: ${{ vars.VITE_API_ENDPOINT }}
VITE_TWITTER_REDIRECT_URL: ${{ vars.VITE_TWITTER_REDIRECT_URL }}
VITE_MASTODON_SERVER01: ${{ vars.VITE_MASTODON_SERVER01 }}
VITE_MASTODON_SERVER02: ${{ vars.VITE_MASTODON_SERVER02 }}
defaults:
run:
working-directory: ./
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "全てのブランチを clone"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.17.1
- run: echo "SPA を生成"
- run: npm ci
working-directory: frontend
- run: npm run build-prod
working-directory: frontend
- run: echo "pub ブランチに変更(GitHub Pages)"
- run: git checkout publish --force
- run: git pull
- run: echo "生成した SPA を publish の docs にコピー"
- run: rm -rf ./docs/*
- run: cp -r ./frontend/dist/* ./docs
- run: echo "publish へ push してサイト更新"
- run: git config --global user.email "bot@github.com"
- run: git config --global user.name "BOT"
- run: git add ./docs
- run: git diff --staged --quiet || git commit -m "publish site"
- run: git push