Skip to content

Commit d535b73

Browse files
Merge pull request #11 from MichaelCurrin/build-upgrade-jekyll
build: upgrade Jekyll to 4
2 parents b12842e + 77a9b7a commit d535b73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+167
-130
lines changed

β€Ž.github/workflows/main.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: GH Pages Deploy
2+
3+
on:
4+
push:
5+
branches: master
6+
paths-ignore:
7+
- README.md
8+
9+
pull_request:
10+
branches: master
11+
paths-ignore:
12+
- README.md
13+
14+
jobs:
15+
build-deploy:
16+
name: Build and deploy
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout πŸ›ŽοΈ
22+
uses: actions/checkout@v2
23+
24+
- name: Set up Ruby πŸ’Ž
25+
uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: "3"
28+
bundler-cache: true
29+
30+
- name: Build πŸ—
31+
run: make build
32+
33+
- name: Deploy to GH Pages πŸš€
34+
if: ${{ github.event_name != 'pull_request' }}
35+
uses: peaceiris/actions-gh-pages@v3
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: _site

β€ŽGemfile

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

3-
gem "jekyll", "~> 3.9"
4-
gem "kramdown-parser-gfm", "~> 1.1.0"
3+
gem "jekyll", "~> 4.2"
54
gem "webrick", "~> 1.7"
65

76
gem "fractal", git: "https://github.com/MichaelCurrin/fractal"
8-
9-
group :jekyll_plugins do
10-
gem "jekyll-remote-theme", "~> 0.4.3"
11-
end

β€ŽREADME.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Code Cookbook πŸ‘©β€πŸ’»πŸ‘¨β€πŸ³πŸ“–πŸ₯—
22
> Reusable code patterns which you can use as reference or copy to your project
33
4+
[![GH Pages Deploy](https://github.com/MichaelCurrin/code-cookbook/workflows/GH%20Pages%20Deploy/badge.svg)](https://github.com/MichaelCurrin/code-cookbook/actions?query=workflow:"GH+Pages+Deploy")
45
[![GitHub tag](https://img.shields.io/github/tag/MichaelCurrin/code-cookbook?include_prereleases&sort=semver)](https://github.com/MichaelCurrin/code-cookbook/releases/)
56
[![License](https://img.shields.io/badge/License-MIT-blue)](#license)
67

7-
[![Jekyll - 3.9](https://img.shields.io/badge/Jekyll-3.9-blue?logo=jekyll&logoColor=white)](https://jekyllrb.com)
8+
[![Jekyll](https://img.shields.io/badge/Jekyll-4-blue?logo=jekyll&logoColor=white)](https://jekyllrb.com)
89
[![theme - fractal](https://img.shields.io/static/v1?label=theme&message=fractal&color=blue&logo=github)](https://github.com/MichaelCurrin/fractal)
910
[![Hosted with - GitHub Pages](https://img.shields.io/badge/Hosted_with-GitHub_Pages-blue?logo=github&logoColor=white)](https://pages.github.com/)
1011

@@ -22,7 +23,7 @@
2223

2324
<div align="center">
2425

25-
[![View site - GH Pages](https://img.shields.io/static/v1?label=View+site&message=GH+Pages&color=2ea44f&style=for-the-badge)](https://michaelcurrin.github.io/code-cookbook/)
26+
[![View site - GH Pages](https://img.shields.io/static/v1?label=View+site&message=GH+Pages&color=2ea44f&style=for-the-badge)](https://michaelcurrin.github.io/code-cookbook/ "Go to website")
2627

2728
</div>
2829

β€Ž_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ strict_front_matter: true
3535

3636
### Theme boilerplate ###
3737

38-
remote_theme: MichaelCurrin/fractal
38+
theme: fractal
3939

4040
titles_from_headings:
4141
strip_title: true

β€Žindex.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ layout: home
77
88
Welcome to **Code Cookbook**.
99

10-
This aims to have an entire recipe to solve a problem. Such as a script or config, or a few files which work together.
10+
This aims to have an entire recipe to solve a problem. Such as a script or config, or a few files which work together.
1111

1212
And the recipes are based on real-world code as much as possible, collecting from repos or docs I encounter or from my own projects.
1313

1414
<div align="center" style="padding-bottom: 1em;">
15-
<a href="{{ site.baseurl }}{% link recipes/index.md %}">
15+
<a href="{% link recipes/index.md %}">
1616
<img src="https://img.shields.io/badge/all_recipe_topics-blue?style=for-the-badge"
1717
alt="Go to recipes"/>
1818
</a>
@@ -47,12 +47,12 @@ Highlights of this site.
4747
- Commands and configs for using Docker and Kubernetes.
4848

4949

50-
[Vue]: {{ site.baseurl }}{% link recipes/javascript/packages/vue/index.md %}
51-
[EditorConfig]: {{ site.baseurl }}{% link recipes/other/editor-config.md %}
52-
[Make]: {{ site.baseurl }}{% link recipes/make/index.md %}
53-
[CI/CD]: {{ site.baseurl }}{% link recipes/ci-cd/index.md %}
54-
[Workflows]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/index.md %}
55-
[SEO]: {{ site.baseurl }}{% link recipes/web/seo/index.md %}
56-
[Shell]: {{ site.baseurl }}{% link recipes/shell/index.md %}
57-
[Jekyll]: {{ site.baseurl }}{% link recipes/jekyll/index.md %}
58-
[Containers]: {{ site.baseurl }}{% link recipes/containers/index.md %}
50+
[Vue]: {% link recipes/javascript/packages/vue/index.md %}
51+
[EditorConfig]: {% link recipes/other/editor-config.md %}
52+
[Make]: {% link recipes/make/index.md %}
53+
[CI/CD]: {% link recipes/ci-cd/index.md %}
54+
[Workflows]: {% link recipes/ci-cd/github-actions/workflows/index.md %}
55+
[SEO]: {% link recipes/web/seo/index.md %}
56+
[Shell]: {% link recipes/shell/index.md %}
57+
[Jekyll]: {% link recipes/jekyll/index.md %}
58+
[Containers]: {% link recipes/containers/index.md %}

β€Žrecipes/ansible/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ logo: ansible
55

66
Default config files in the root `/etc/ansible/` directory:
77

8-
- [Config]({{ site.baseurl }}{% link recipes/ansible/config.md %})
9-
- [Hosts]({{ site.baseurl }}{% link recipes/ansible/hosts.md %})
8+
- [Config]({% link recipes/ansible/config.md %})
9+
- [Hosts]({% link recipes/ansible/hosts.md %})
1010

1111
See [User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) in the docs.

β€Žrecipes/ci-cd/github-actions/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ Here are some places to start to get into workflow file samples.
1717
- See sample workflows across programming languages.
1818

1919
[GitHub Actions]: https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/ci-cd/github-actions/
20-
[Basic generic workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/basic.md %}
21-
[Basic Node workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
22-
[Workflows]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/index.md %}
20+
[Basic generic workflow]: {% link recipes/ci-cd/github-actions/workflows/basic.md %}
21+
[Basic Node workflow]: {% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
22+
[Workflows]: {% link recipes/ci-cd/github-actions/workflows/index.md %}

β€Žrecipes/ci-cd/github-actions/tokens/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ A GitHub Action needs permissions to push to your `gh-pages` branch - so you mus
77

88
Here are the approaches, from simplest to most complex to manage. A summary is provided.
99

10-
- [GitHub token]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/github-token.md %})
10+
- [GitHub token]({% link recipes/ci-cd/github-actions/tokens/github-token.md %})
1111
- API key scoped to a single repo.
1212
- Auto-generated for a GH workflow - low effort.
1313
- Very secure - you never have to copy or even view the value.
1414
- The main limitation is that this only works for GitHub Actions, unlike the others.
15-
- [Access token]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/access-token.md %})
15+
- [Access token]({% link recipes/ci-cd/github-actions/tokens/access-token.md %})
1616
- API key scoped to **all** repos in your GH account.
1717
- Easy to generate and add to a workflow.
1818
- **Warning** - this is the least secure. A token is for your entire profile, not per repo. With public repo access, a token gives read and write access to all your public repos - a compromised token can be used to do a lot of damage.
1919
- This key is useful for doing actions with the GH API such as reporting on stats.
20-
- [Deploy key]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/deploy-key.md %})
20+
- [Deploy key]({% link recipes/ci-cd/github-actions/tokens/deploy-key.md %})
2121
- API key scoped to a repo.
2222
- Needs to be generated **locally** once using SSH tool and your email address then pasted in so it takes more effort.
2323
- Slightly less secure then GH Token as you deal with a value, but this is more flexible.

β€Žrecipes/ci-cd/github-actions/workflows/basic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Minimal workflows for GH Actions to get you started
55

66
If you are a JS developer, see the [Basic Node][] section.
77

8-
[Basic Node]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
8+
[Basic Node]: {% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
99

1010

1111
## Samples

β€Žrecipes/ci-cd/github-actions/workflows/build-release-assets/go.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ title: Release Go assets
33
logo: go
44
---
55

6-
See the [Go]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/go/index.md %}) workflows section.
6+
See the [Go]({% link recipes/ci-cd/github-actions/workflows/go/index.md %}) workflows section.

β€Žrecipes/ci-cd/github-actions/workflows/cache.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Use the cache option on `setup-node` action:
5858
- name: Install dependencies
5959
run: npm install
6060
```
61-
61+
6262
#### Use cache action
6363

6464
The cache location will be `~/.npm` on Unix/Posix. See [NPM cache](https://docs.npmjs.com/cli/cache#cache) in the docs NPM docs.
@@ -142,5 +142,5 @@ See [Ruby workflow][] recipes.
142142

143143
{% endraw %}
144144

145-
[Ruby workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
146-
[NPM workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/npm.md %}
145+
[Ruby workflow]: {% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
146+
[NPM workflow]: {% link recipes/ci-cd/github-actions/workflows/node/npm.md %}

β€Žrecipes/ci-cd/github-actions/workflows/check-links/html-proofer-generic.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ How to use a Ruby gem as a CLI tool to validate links in your static HTML, for b
1212
- For use of `html-proofer` outside of GH Actions or how to add it to your `Gemfile`, see the
1313
- [HTML Proofer wrappers][]
1414

15-
[HTML Proofer gem]: {{ site.baseurl }}{% link recipes/web/check-links/html-proofer.md %}
16-
[HTML Proofer wrappers]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/check-links/html-proofer-wrappers.md %}
15+
[HTML Proofer gem]: {% link recipes/web/check-links/html-proofer.md %}
16+
[HTML Proofer wrappers]: {% link recipes/ci-cd/github-actions/workflows/check-links/html-proofer-wrappers.md %}
1717

1818
## Samples
1919

β€Žrecipes/ci-cd/github-actions/workflows/check-links/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ Some action recipes here are intended for markdown files, while others will anal
1212

1313
- [Check links][] recipes in the Web section.
1414

15-
[Check links]: {{ site.baseurl }}{% link recipes/web/check-links/index.md %}
15+
[Check links]: {% link recipes/web/check-links/index.md %}

β€Žrecipes/ci-cd/github-actions/workflows/commit.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Commit
3-
description: How to commit and push files during the CI flow
3+
description: How to commit and push files during the CI flow
44
---
55

66

7-
## Related
7+
## Related
88

99
- [Create Pull Request][] workflows - some recipes there will commit for you, so you do not need a separate commit step.
1010

11-
[Create Pull Request]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/create-pull-request.md %}
11+
[Create Pull Request]: {% link recipes/ci-cd/github-actions/workflows/create-pull-request.md %}
1212

1313

1414
{% raw %}
@@ -29,7 +29,7 @@ Some situations when you might want to add/edit and commit files all during a si
2929
- Update a list of contributors. (A GH bot can handle this for you)
3030
- Update a table of contents.
3131
- Code changes.
32-
- Perform lint fixes.
32+
- Perform lint fixes.
3333
- Perform package upgrades.
3434

3535

@@ -48,7 +48,7 @@ This is slightly verbose but not too long. You know exactly what it is doing and
4848
steps:
4949
- name: Checkout
5050
# uses: ...
51-
51+
5252
- name: Build
5353
# run: ...
5454

@@ -90,7 +90,7 @@ See [push-new-files-back-to-master](https://github.com/marketplace/actions/push-
9090
steps:
9191
- name: Checkout
9292
# uses: ...
93-
93+
9494
- name: Build
9595
# run: ...
9696

β€Žrecipes/ci-cd/github-actions/workflows/create-pull-request.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Create Pull Request
22

3-
## Related
3+
## Related
44

55
- [Commit][] workflows so you create a commit without a Pull Request, such as if you want to commit on the main branch.
66

7-
[Commit]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/commit.md %}
7+
[Commit]: {% link recipes/ci-cd/github-actions/workflows/commit.md %}
88

99

1010
{% raw %}
@@ -29,8 +29,8 @@ steps:
2929
All inputs are optional but you probably want to set some of these:
3030
3131
- `title` for PR title.
32-
- `branch` for branch name to create.
33-
- `delete-branch` - Delete the branch when closing pull requests, and when undeleted after merging. Recommended as `true`. I don't know how this compares to the settings of the repo. This optional might not be useful.
32+
- `branch` for branch name to create.
33+
- `delete-branch` - Delete the branch when closing pull requests, and when undeleted after merging. Recommended as `true`. I don't know how this compares to the settings of the repo. This optional might not be useful.
3434

3535
The docs recommend using a fix branch name, rather than one that is unique, to avoid to many branches/PRs.
3636

@@ -40,7 +40,7 @@ With options:
4040
steps:
4141
- name: Create Pull Request
4242
uses: peter-evans/create-pull-request@v3
43-
with:
43+
with:
4444
title: My PR title
4545
commit-message: My commit message
4646
branch: my-branch-name
@@ -50,11 +50,11 @@ steps:
5050

5151
## No action
5252

53-
Here we hit the GitHub API to create a PR.
53+
Here we hit the GitHub API to create a PR.
5454

5555
We don't actually make the commit or branch here - just the PR itself. See [Commit][] recipe for making the commit.
5656

57-
[Commit]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/commit.md %}
57+
[Commit]: {% link recipes/ci-cd/github-actions/workflows/commit.md %}
5858

5959
### Same repo
6060

@@ -108,7 +108,7 @@ jobs:
108108
}
109109
EOF
110110
)
111-
curl
111+
curl
112112
https://api.github.com/repos/my-user/my-repo/pulls \
113113
--header "Authorization: token ${TOKEN}" \
114114
-H "Content-Type:application/json" \

β€Žrecipes/ci-cd/github-actions/workflows/deploy-gh-pages/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ See [Tokens](/recipes/ci-cd/github-actions/tokens/) guide on use of tokens.
1919
- [GH Pages Deploy - Node][] page.
2020
- [MkDocs][] section.
2121

22-
[Build and deploy - Jekyll]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/jekyll/build/index.md %}
23-
[GH Pages Deploy - Node]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/gh-pages.md %}
24-
[MkDocs]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/mkdocs/index.md %}
22+
[Build and deploy - Jekyll]: {% link recipes/ci-cd/github-actions/workflows/jekyll/build/index.md %}
23+
[GH Pages Deploy - Node]: {% link recipes/ci-cd/github-actions/workflows/node/gh-pages.md %}
24+
[MkDocs]: {% link recipes/ci-cd/github-actions/workflows/mkdocs/index.md %}

β€Žrecipes/ci-cd/github-actions/workflows/go/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can skip GitHub Actions.
1818

1919
See [Build and release assets][] workflows section.
2020

21-
1. Use shell commands in the workflow to build one or more output files, such as for each OS.
21+
1. Use shell commands in the workflow to build one or more output files, such as for each OS.
2222
2. Use the generic `create-release` action to make a release.
2323
3. Use the generic `upload-actions` action to attach the files to the new release.
2424

@@ -27,10 +27,10 @@ See [Build and release assets][] workflows section.
2727
Use [Go Releaser][] action to handle the steps for you in a single action. This makes it easy to maintain and reuse the workflow across Go projecs. It includes support for compiling across platforms too.
2828

2929

30-
[Build and release assets]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/build-release-assets/index.md %}
31-
[Go Releaser]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/go/go-releaser.md %}
30+
[Build and release assets]: {% link recipes/ci-cd/github-actions/workflows/build-release-assets/index.md %}
31+
[Go Releaser]: {% link recipes/ci-cd/github-actions/workflows/go/go-releaser.md %}
3232

3333

3434
### Related sections
3535

36-
- [Go]({{ site.baseurl }}{% link recipes/go/index.md %}) recipes section.
36+
- [Go]({% link recipes/go/index.md %}) recipes section.

β€Žrecipes/ci-cd/github-actions/workflows/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Samples, resources and instructions around run a GH Actions workflo
44
---
55

66

7-
The pages in this section covers a variety of tools and flows including Python, NPM, Jekyll, GitHub Pages and mixing them together.
7+
The pages in this section covers a variety of tools and flows including Python, NPM, Jekyll, GitHub Pages and mixing them together.
88

99
Here are some highlights.
1010

@@ -42,8 +42,8 @@ Here are some popular things to do:
4242
- Continue to [Basic Node][] as that is still simple and will be useful for Node.js developers.
4343
- To learn more about specific fields like `jobs` and the `on` trigger, see my [GitHub Actions cheatsheets][].
4444

45-
[Basic]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/basic.md %}
46-
[Basic Node]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
45+
[Basic]: {% link recipes/ci-cd/github-actions/workflows/basic.md %}
46+
[Basic Node]: {% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
4747
[GitHub Actions cheatsheets]: https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/ci-cd/github-actions/
4848

4949
### Building and serving a site

β€Žrecipes/ci-cd/github-actions/workflows/jekyll/build/container.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Related recipe - [Jekyll][] in the Container section.
44

55
This flow runs a **Docker container**. If you don't want to use Docker, see [Jekyll Ruby Action][], which is a light approach.
66

7-
[Jekyll]: {{ site.baseurl }}{% link recipes/containers/docker/jekyll.md %}
8-
[Jekyll Ruby Action]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/jekyll/build/ruby-action.md %}
7+
[Jekyll]: {% link recipes/containers/docker/jekyll.md %}
8+
[Jekyll Ruby Action]: {% link recipes/ci-cd/github-actions/workflows/jekyll/build/generic.md %}
99

1010
{% raw %}
1111

β€Žrecipes/ci-cd/github-actions/workflows/jekyll/build/generic.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ description: Use a Ruby action to set up Ruby and gems, then build and add a gen
1010
- [jekyll-gh-actions-quickstart][] template repo with a live demo and tutorial.
1111

1212
[jekyll-gh-actions-quickstart]: https://github.com/MichaelCurrin/jekyll-gh-actions-quickstart
13-
[GH Actions Ruby]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
13+
[GH Actions Ruby]: {% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
1414

1515

1616
## Why generic?
1717

18-
Why use this this approach? This is a great generic approach, rather than being tied to using an action which is built around Jekyll or Jekyll + GH Pages.
18+
Why use this this approach? This is a great generic approach, rather than being tied to using an action which is built around Jekyll or Jekyll + GH Pages.
1919

2020
The Ruby action does the job well, it reusable across non-Jekyll projects and it will probably be simpler and better maintained than some Jekyll-specific one. Seeing as the Ruby one has wider appeal to the community than a Jekyll-specifi solution.
2121

@@ -71,4 +71,3 @@ Here we set up a Ruby environment using the `setup-ruby` action. A param is pass
7171
Replace the Build command `make build` if you prefer.
7272

7373
{% endraw %}
74-

0 commit comments

Comments
Β (0)