-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.51 KB
/
depoy_github_pages.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
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
strategy:
matrix:
node-version: [17.x]
steps:
- run: echo "全てのブランチを clone"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: publish-site
uses: actions/setup-node@v4
with:
node-version: v18.17.1
- run: echo "SPA を生成"
- run: npm ci
working-directory: ./
- run: npm run build-prod
working-directory: ./
- 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 ./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 commit -m "publish site"
- run: git push