Skip to content

Commit 822b792

Browse files
committed
Convert the CI workflow into a deployment workflow
1 parent 610eace commit 822b792

File tree

1 file changed

+48
-18
lines changed

1 file changed

+48
-18
lines changed

Diff for: .github/workflows/jekyll.yml

+48-18
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,63 @@
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+
8+
# Allows us to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow one concurrent deployment
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
421

522
jobs:
23+
# Build job
624
build:
7-
825
runs-on: ubuntu-latest
9-
1026
steps:
11-
- uses: actions/checkout@v3
12-
13-
- uses: actions/setup-node@v3
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
- name: Set up Node
30+
uses: actions/setup-node@v3
1431
with:
1532
node-version: 16
1633
cache: 'npm'
1734
- name: Install node modules
1835
run: npm install
19-
2036
- name: Set up Ruby
2137
uses: ruby/setup-ruby@ece82769428359c077b5a5eaff268902a303c101
2238
with:
23-
ruby-version: '3.0'
39+
ruby-version: '3.1'
2440
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25-
26-
- name: Build and test with Rake
27-
run: bundle exec rake
28-
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"
41+
- name: Set up Pages
42+
id: pages
43+
uses: actions/configure-pages@v2
44+
- name: Build with Jekyll
45+
# Outputs to the './_site' directory by default
46+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
47+
env:
48+
JEKYLL_ENV: production
49+
- name: Upload artifact
50+
# Automatically uploads an artifact from the './_site' directory by default
51+
uses: actions/upload-pages-artifact@v1
52+
53+
# Deployment job
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
runs-on: ubuntu-latest
59+
needs: build
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)