-
Notifications
You must be signed in to change notification settings - Fork 25
75 lines (62 loc) · 2.3 KB
/
Copy pathdeploy.yml
File metadata and controls
75 lines (62 loc) · 2.3 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
# .github/workflows/deploy.yml
name: Deploy to GitHub Pages
# Run this workflow every time you push a change to your 'main' branch
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# --- Check out the 'main' branch ---
# This downloads your main branch code into the workflow runner.
- name: Checkout main branch
uses: actions/checkout@v4
with:
path: main # Checkout to a 'main' subdirectory
# --- Check out the 'caches' branch ---
# This downloads your caches branch into a different subdirectory.
# This step will fail if the 'caches' branch doesn't exist yet, which is fine on the first run.
- name: Checkout caches branch
uses: actions/checkout@v4
with:
ref: caches
path: caches # Checkout to a 'caches' subdirectory
continue-on-error: true
# --- Combine the files ---
- name: Combine files
run: |
# Create a 'public' directory to hold the final website files
mkdir -p public
# Copy everything from the 'main' branch checkout, IGNORING dotfiles
cp -r ./main/* ./public/
# If the caches directory exists, copy its contents, IGNORING dotfiles
if [ -d "./caches" ]; then
cp -r ./caches/* ./public/
fi
# --- Install Pandoc ---
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc
# --- Convert README.md to index.html ---
- name: Convert README to index.html
run: |
pandoc --standalone --metadata pagetitle="Home" -M linkcolor="#007bff" -M mainfont="sans-serif" -M maxwidth="45em" -f gfm -t html ./public/README.md -o ./public/index.html
# --- Upload the combined site ---
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# --- Deploy to GitHub Pages ---
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4