Skip to content

Commit

Permalink
Merge pull request #11 from MichaelCurrin/build-upgrade-jekyll
Browse files Browse the repository at this point in the history
build: upgrade Jekyll to 4
  • Loading branch information
MichaelCurrin authored Nov 27, 2021
2 parents b12842e + 77a9b7a commit d535b73
Show file tree
Hide file tree
Showing 50 changed files with 167 additions and 130 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: GH Pages Deploy

on:
push:
branches: master
paths-ignore:
- README.md

pull_request:
branches: master
paths-ignore:
- README.md

jobs:
build-deploy:
name: Build and deploy

runs-on: ubuntu-latest

steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v2

- name: Set up Ruby πŸ’Ž
uses: ruby/setup-ruby@v1
with:
ruby-version: "3"
bundler-cache: true

- name: Build πŸ—
run: make build

- name: Deploy to GH Pages πŸš€
if: ${{ github.event_name != 'pull_request' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _site
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
source "https://rubygems.org"

gem "jekyll", "~> 3.9"
gem "kramdown-parser-gfm", "~> 1.1.0"
gem "jekyll", "~> 4.2"
gem "webrick", "~> 1.7"

gem "fractal", git: "https://github.com/MichaelCurrin/fractal"

group :jekyll_plugins do
gem "jekyll-remote-theme", "~> 0.4.3"
end
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Code Cookbook πŸ‘©β€πŸ’»πŸ‘¨β€πŸ³πŸ“–πŸ₯—
> Reusable code patterns which you can use as reference or copy to your project
[![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")
[![GitHub tag](https://img.shields.io/github/tag/MichaelCurrin/code-cookbook?include_prereleases&sort=semver)](https://github.com/MichaelCurrin/code-cookbook/releases/)
[![License](https://img.shields.io/badge/License-MIT-blue)](#license)

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

Expand All @@ -22,7 +23,7 @@

<div align="center">

[![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/)
[![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")

</div>

Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ strict_front_matter: true

### Theme boilerplate ###

remote_theme: MichaelCurrin/fractal
theme: fractal

titles_from_headings:
strip_title: true
Expand Down
22 changes: 11 additions & 11 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ layout: home
Welcome to **Code Cookbook**.

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

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.

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


[Vue]: {{ site.baseurl }}{% link recipes/javascript/packages/vue/index.md %}
[EditorConfig]: {{ site.baseurl }}{% link recipes/other/editor-config.md %}
[Make]: {{ site.baseurl }}{% link recipes/make/index.md %}
[CI/CD]: {{ site.baseurl }}{% link recipes/ci-cd/index.md %}
[Workflows]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/index.md %}
[SEO]: {{ site.baseurl }}{% link recipes/web/seo/index.md %}
[Shell]: {{ site.baseurl }}{% link recipes/shell/index.md %}
[Jekyll]: {{ site.baseurl }}{% link recipes/jekyll/index.md %}
[Containers]: {{ site.baseurl }}{% link recipes/containers/index.md %}
[Vue]: {% link recipes/javascript/packages/vue/index.md %}
[EditorConfig]: {% link recipes/other/editor-config.md %}
[Make]: {% link recipes/make/index.md %}
[CI/CD]: {% link recipes/ci-cd/index.md %}
[Workflows]: {% link recipes/ci-cd/github-actions/workflows/index.md %}
[SEO]: {% link recipes/web/seo/index.md %}
[Shell]: {% link recipes/shell/index.md %}
[Jekyll]: {% link recipes/jekyll/index.md %}
[Containers]: {% link recipes/containers/index.md %}
4 changes: 2 additions & 2 deletions recipes/ansible/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ logo: ansible

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

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

See [User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) in the docs.
6 changes: 3 additions & 3 deletions recipes/ci-cd/github-actions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Here are some places to start to get into workflow file samples.
- See sample workflows across programming languages.

[GitHub Actions]: https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/ci-cd/github-actions/
[Basic generic workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/basic.md %}
[Basic Node workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
[Workflows]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/index.md %}
[Basic generic workflow]: {% link recipes/ci-cd/github-actions/workflows/basic.md %}
[Basic Node workflow]: {% link recipes/ci-cd/github-actions/workflows/node/basic.md %}
[Workflows]: {% link recipes/ci-cd/github-actions/workflows/index.md %}
6 changes: 3 additions & 3 deletions recipes/ci-cd/github-actions/tokens/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ A GitHub Action needs permissions to push to your `gh-pages` branch - so you mus

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

- [GitHub token]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/github-token.md %})
- [GitHub token]({% link recipes/ci-cd/github-actions/tokens/github-token.md %})
- API key scoped to a single repo.
- Auto-generated for a GH workflow - low effort.
- Very secure - you never have to copy or even view the value.
- The main limitation is that this only works for GitHub Actions, unlike the others.
- [Access token]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/access-token.md %})
- [Access token]({% link recipes/ci-cd/github-actions/tokens/access-token.md %})
- API key scoped to **all** repos in your GH account.
- Easy to generate and add to a workflow.
- **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.
- This key is useful for doing actions with the GH API such as reporting on stats.
- [Deploy key]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/tokens/deploy-key.md %})
- [Deploy key]({% link recipes/ci-cd/github-actions/tokens/deploy-key.md %})
- API key scoped to a repo.
- Needs to be generated **locally** once using SSH tool and your email address then pasted in so it takes more effort.
- Slightly less secure then GH Token as you deal with a value, but this is more flexible.
Expand Down
2 changes: 1 addition & 1 deletion recipes/ci-cd/github-actions/workflows/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Minimal workflows for GH Actions to get you started

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

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


## Samples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ title: Release Go assets
logo: go
---

See the [Go]({{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/go/index.md %}) workflows section.
See the [Go]({% link recipes/ci-cd/github-actions/workflows/go/index.md %}) workflows section.
6 changes: 3 additions & 3 deletions recipes/ci-cd/github-actions/workflows/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Use the cache option on `setup-node` action:
- name: Install dependencies
run: npm install
```

#### Use cache action

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

{% endraw %}

[Ruby workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
[NPM workflow]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/npm.md %}
[Ruby workflow]: {% link recipes/ci-cd/github-actions/workflows/ruby/index.md %}
[NPM workflow]: {% link recipes/ci-cd/github-actions/workflows/node/npm.md %}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ How to use a Ruby gem as a CLI tool to validate links in your static HTML, for b
- For use of `html-proofer` outside of GH Actions or how to add it to your `Gemfile`, see the
- [HTML Proofer wrappers][]

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

## Samples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Some action recipes here are intended for markdown files, while others will anal

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

[Check links]: {{ site.baseurl }}{% link recipes/web/check-links/index.md %}
[Check links]: {% link recipes/web/check-links/index.md %}
12 changes: 6 additions & 6 deletions recipes/ci-cd/github-actions/workflows/commit.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Commit
description: How to commit and push files during the CI flow
description: How to commit and push files during the CI flow
---


## Related
## Related

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

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


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


Expand All @@ -48,7 +48,7 @@ This is slightly verbose but not too long. You know exactly what it is doing and
steps:
- name: Checkout
# uses: ...

- name: Build
# run: ...

Expand Down Expand Up @@ -90,7 +90,7 @@ See [push-new-files-back-to-master](https://github.com/marketplace/actions/push-
steps:
- name: Checkout
# uses: ...

- name: Build
# run: ...

Expand Down
16 changes: 8 additions & 8 deletions recipes/ci-cd/github-actions/workflows/create-pull-request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Create Pull Request

## Related
## Related

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

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


{% raw %}
Expand All @@ -29,8 +29,8 @@ steps:
All inputs are optional but you probably want to set some of these:
- `title` for PR title.
- `branch` for branch name to create.
- `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.
- `branch` for branch name to create.
- `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.

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

Expand All @@ -40,7 +40,7 @@ With options:
steps:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
with:
title: My PR title
commit-message: My commit message
branch: my-branch-name
Expand All @@ -50,11 +50,11 @@ steps:

## No action

Here we hit the GitHub API to create a PR.
Here we hit the GitHub API to create a PR.

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

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

### Same repo

Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
}
EOF
)
curl
curl
https://api.github.com/repos/my-user/my-repo/pulls \
--header "Authorization: token ${TOKEN}" \
-H "Content-Type:application/json" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ See [Tokens](/recipes/ci-cd/github-actions/tokens/) guide on use of tokens.
- [GH Pages Deploy - Node][] page.
- [MkDocs][] section.

[Build and deploy - Jekyll]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/jekyll/build/index.md %}
[GH Pages Deploy - Node]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/node/gh-pages.md %}
[MkDocs]: {{ site.baseurl }}{% link recipes/ci-cd/github-actions/workflows/mkdocs/index.md %}
[Build and deploy - Jekyll]: {% link recipes/ci-cd/github-actions/workflows/jekyll/build/index.md %}
[GH Pages Deploy - Node]: {% link recipes/ci-cd/github-actions/workflows/node/gh-pages.md %}
[MkDocs]: {% link recipes/ci-cd/github-actions/workflows/mkdocs/index.md %}
8 changes: 4 additions & 4 deletions recipes/ci-cd/github-actions/workflows/go/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can skip GitHub Actions.

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

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

Expand All @@ -27,10 +27,10 @@ See [Build and release assets][] workflows section.
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.


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


### Related sections

- [Go]({{ site.baseurl }}{% link recipes/go/index.md %}) recipes section.
- [Go]({% link recipes/go/index.md %}) recipes section.
6 changes: 3 additions & 3 deletions recipes/ci-cd/github-actions/workflows/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Samples, resources and instructions around run a GH Actions workflo
---


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

Here are some highlights.

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

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

### Building and serving a site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Related recipe - [Jekyll][] in the Container section.

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

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

{% raw %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ description: Use a Ruby action to set up Ruby and gems, then build and add a gen
- [jekyll-gh-actions-quickstart][] template repo with a live demo and tutorial.

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


## Why generic?

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.
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.

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.

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

{% endraw %}

Loading

0 comments on commit d535b73

Please sign in to comment.