Skip to content

Commit a4a9cc1

Browse files
authored
Merge pull request #936 from github/parkerbxyz/workflows
Use GitHub Actions to build and deploy the GitHub Pages site
2 parents 98d43a3 + 3c6e49f commit a4a9cc1

File tree

11 files changed

+167
-227
lines changed

11 files changed

+167
-227
lines changed

Diff for: .github/workflows/jekyll.yml

+55-15
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,73 @@
1-
name: CI for GitHub Pages site
1+
name: Deploy Jekyll site to Pages
22

3-
on: [push]
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ["main"]
7+
# Runs on pull requests targeting the default branch
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
# Allows us to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow one concurrent deployment
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: true
424

525
jobs:
26+
# Build job
627
build:
7-
828
runs-on: ubuntu-latest
9-
1029
steps:
11-
- uses: actions/checkout@v3
12-
13-
- uses: actions/setup-node@v3
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
- name: Set up Node
33+
uses: actions/setup-node@v3
1434
with:
1535
node-version: 16
1636
cache: 'npm'
1737
- name: Install node modules
1838
run: npm install
19-
2039
- name: Set up Ruby
2140
uses: ruby/setup-ruby@ece82769428359c077b5a5eaff268902a303c101
2241
with:
23-
ruby-version: '3.0'
2442
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25-
43+
- name: Set up Pages
44+
id: pages
45+
uses: actions/configure-pages@v2
2646
- name: Build and test with Rake
47+
# Only run in pull requests
48+
if: github.event_name == 'pull_request'
2749
run: bundle exec rake
50+
- name: Build with Jekyll
51+
# Don't run in pull requests
52+
if: github.event_name != 'pull_request'
53+
# Outputs to the './_site' directory by default
54+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
55+
env:
56+
JEKYLL_ENV: production
57+
- name: Upload artifact
58+
# Automatically uploads an artifact from the './_site' directory by default
59+
uses: actions/upload-pages-artifact@v1
2860

29-
- name: Build the site in the jekyll/builder container
30-
run: |
31-
docker run \
32-
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
33-
jekyll/builder:latest /bin/bash -c "chmod a+w /srv/jekyll/Gemfile.lock && chmod 777 /srv/jekyll && jekyll build --future"
61+
# Deployment job
62+
deploy:
63+
# Only run on pushes to the default branch
64+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v1

Diff for: .ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.1.2

Diff for: Gemfile

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
source "https://rubygems.org"
22

3-
gem 'github-pages', group: :jekyll_plugins
3+
gem 'jekyll'
44
gem 'html-proofer'
5-
gem 'rack-contrib'
65
gem 'rake'
7-
gem 'jekyll-octicons'
6+
7+
group :jekyll_plugins do
8+
gem 'jekyll-sass-converter', github: 'jekyll/jekyll-sass-converter'
9+
gem 'sass-embedded'
10+
gem 'jekyll-paginate'
11+
gem 'jekyll-sitemap'
12+
gem 'jekyll-gist'
13+
gem 'jekyll-feed'
14+
gem 'jemoji'
15+
gem 'jekyll-redirect-from'
16+
gem 'jekyll-octicons'
17+
end

0 commit comments

Comments
 (0)