Skip to content

Commit 18165a5

Browse files
committed
add page workflow
1 parent fbff53e commit 18165a5

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/pages.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build and Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- 'doc/cheatsheet/**' # Only trigger when files in doc/cheatsheet change
10+
11+
jobs:
12+
build-and-deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: '3.0'
22+
bundler-cache: true
23+
24+
- name: Create Jekyll site structure
25+
run: |
26+
mkdir -p _layouts _includes _sass assets
27+
# Copy only cheatsheet files to a temporary directory
28+
mkdir -p temp_site/doc/cheatsheet
29+
cp -r doc/cheatsheet/* temp_site/doc/cheatsheet/
30+
# Create a minimal config file
31+
echo "source: temp_site" > _config.yml
32+
echo "baseurl: /CS_basics" >> _config.yml
33+
echo "title: CS Basics Cheatsheets" >> _config.yml
34+
echo "markdown: kramdown" >> _config.yml
35+
36+
- name: Install Jekyll and Dependencies
37+
run: |
38+
gem install bundler
39+
bundle init
40+
bundle add jekyll -v "~> 3.9.0"
41+
bundle add github-pages
42+
bundle install
43+
44+
- name: Build Site
45+
run: bundle exec jekyll build --source temp_site --destination _site
46+
47+
- name: Deploy
48+
uses: peaceiris/actions-gh-pages@v3
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
publish_dir: ./_site

0 commit comments

Comments
 (0)