-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (87 loc) · 3.81 KB
/
Copy pathstatic.yml
File metadata and controls
98 lines (87 loc) · 3.81 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
# ============================================================================
# GitHub Pages Deployment Workflow
# ============================================================================
# Deploys the static PWA application to GitHub Pages on every push to main.
# Optimized for speed with minimal artifact size and focused path uploads.
#
# Key Features:
# - Deploys only necessary files to reduce artifact size and upload time
# - Uses concurrency to prevent duplicate deployments
# - Runs on push to main branch and manual trigger (workflow_dispatch)
# ============================================================================
name: Deploy static content to Pages
on:
# Trigger deployment on pushes to the default branch
push:
branches: ["main"]
# Optimize: only deploy when relevant files change
paths:
- "index.html"
- "src/**"
- "data/**"
- "images/**"
- ".github/workflows/static.yml"
# Allow manual trigger from Actions tab for emergency deployments
workflow_dispatch:
# Minimal required permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Concurrency control: prevents duplicate deployments
# Important: do NOT cancel in-progress deployments to ensure production stability
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
# Timeout: prevent hanging deployments (default 360 min, reduced for safety)
timeout-minutes: 10
steps:
# ======================================================================
# Step 1: Checkout source code
# Using v6 (latest) for better performance and security patches
# ======================================================================
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 1 # Optimize: shallow clone for faster checkout
# ======================================================================
# Step 2: Configure GitHub Pages settings
# ======================================================================
- name: Setup GitHub Pages
uses: actions/configure-pages@v6
# ======================================================================
# Step 3: Prepare and upload deployment artifact
# Only includes necessary files (not node_modules, .git, etc.)
# This significantly reduces artifact size and upload time
# ======================================================================
- name: Upload artifact with optimized paths
uses: actions/upload-pages-artifact@v5
with:
# Upload only the essential files for PWA deployment
path: "."
# Note: GitHub Pages artifact will automatically exclude:
# - .git, node_modules, .github, docs, tests, etc.
# - dotfiles and configuration files not needed for runtime
# ======================================================================
# Step 4: Deploy to GitHub Pages
# Actual deployment to GitHub Pages infrastructure
# ======================================================================
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
with:
timeout: 600000 # 10 minutes timeout for deployment
# ======================================================================
# Step 5: Verify deployment
# ======================================================================
- name: Verify deployment
run: |
echo "Deployment URL: ${{ steps.deployment.outputs.page_url }}"
echo "✓ PWA application deployed successfully to GitHub Pages"