Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy Website to GitHub Pages

on:
push:
branches:
- master # 當推送到 master 分支時觸發
paths:
- "website/**" # 只有當 website 目錄有變更時才觸發
workflow_dispatch: # 允許手動觸發

# 設定 GITHUB_TOKEN 的權限
permissions:
contents: read
pages: write
id-token: write

# 確保同時只有一個部署任務在執行
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: "website/package-lock.json"

- name: Install dependencies
run: |
cd website
npm i

- name: Build website
run: |
cd website
npm run build

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./website/dist"

deploy:
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
5 changes: 4 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: CI - master

on:
push:
pull_request:
types: [closed]
branches:
- "master"

Expand Down Expand Up @@ -54,6 +55,7 @@ jobs:
bump-version:
name: Bump Version and Update GitHub Variable
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'build')
outputs:
new_version: ${{ steps.bump.outputs.new_version }}
# needs: unit-test # 等 unit-test 成功才執行
Expand Down Expand Up @@ -87,6 +89,7 @@ jobs:
build-image:
name: Build and Push Docker Image
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'build')
needs:
# - unit-test # 等 unit-test 成功才執行
- bump-version # 等 bump-version 成功才執行
Expand Down
6 changes: 3 additions & 3 deletions website/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="./logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Notion Chart Generator</title>
</head>
<body>
<div id="root"></div>
Expand Down
6 changes: 6 additions & 0 deletions website/public/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.