-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (91 loc) · 3.35 KB
/
Copy pathpages.yml
File metadata and controls
103 lines (91 loc) · 3.35 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build site, and Deploy site to Pages
on:
# 手動実行
workflow_dispatch:
# mainブランチへのpush
push:
branches: ["main"]
pull_request:
branches: ["main"]
# GitHub Pagesへのデプロイを許可
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
env:
IS_ORIGINAL_REPO: ${{ github.repository == 'code4fukui/fukui-kanko-people-flow-visualization' }}
IS_MAIN_BRANCH: ${{ github.ref == 'refs/heads/main' }}
jobs:
# Vite+Reactのサイトをビルド
build:
runs-on: ubuntu-latest
env:
TZ: "Asia/Tokyo"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4.0.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: pnpm
- name: Install dependencies
run: pnpm install
# 元リポジトリ以外はs3にアップロードする
- name: Build and Upload dist
if: env.IS_ORIGINAL_REPO != 'true' || env.IS_MAIN_BRANCH != 'true'
run: stage="$STAGE" pnpm upload
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUCKET: ${{ secrets.BUCKET }}
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
REGION: ${{ secrets.REGION }}
INTERNAL_ORIGIN: ${{ secrets.INTERNAL_ORIGIN }}
STAGE: "${{ github.repository_owner }}-fkpfv-${{ github.event.number }}"
# Fork元リポジトリのmainブランチではPagesにデプロイする
- name: Setup Pages
if: env.IS_ORIGINAL_REPO == 'true' && env.IS_MAIN_BRANCH == 'true'
uses: actions/configure-pages@v5
- name: Build all apps and create deploy structure
if: env.IS_ORIGINAL_REPO == 'true' && env.IS_MAIN_BRANCH == 'true'
run: |
date
pnpm build
mkdir -p deploy
cp -r packages/whole/dist deploy/whole
cp -r packages/fukui-terminal/dist deploy/fukui-terminal
cp -r packages/tojinbo/dist deploy/tojinbo
cp -r packages/rainbow-line/dist deploy/rainbow-line
cp -r packages/landing-page/dist/* deploy/
mkdir -p deploy/data
find ./data -mindepth 1 -maxdepth 1 ! -name '.*' -exec cp -r {} ./deploy/data/ \;
env:
PAGES: true
PAGES_ROOT: "https://${{ github.repository_owner }}.github.io/fukui-kanko-people-flow-visualization"
- name: Upload artifact
if: env.IS_ORIGINAL_REPO == 'true' && env.IS_MAIN_BRANCH == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: ./deploy
# GitHub Pagesへデプロイ
deploy-pages:
if: github.repository == 'code4fukui/fukui-kanko-people-flow-visualization' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4