Skip to content

Commit 72af521

Browse files
committed
Update Jekyll workflow and add Google Analytics
Replaces the Asciidoc build workflow with a standard Jekyll Pages deployment workflow using official GitHub Actions. Adds Google Analytics tracking to the docs site by including the gtag.js script in the HTML head.
1 parent 08e96fe commit 72af521

File tree

2 files changed

+94
-45
lines changed

2 files changed

+94
-45
lines changed
Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,65 @@
1-
name: build adocs
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
7+
name: Deploy Jekyll site to Pages
28

39
on:
10+
# Runs on pushes targeting the default branch
411
push:
5-
branches:
6-
- main
12+
branches: ["main"]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
pages: write
21+
id-token: write
22+
23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
729
jobs:
8-
adoc_build:
30+
# Build job
31+
build:
932
runs-on: ubuntu-latest
10-
name: HTMLs and PDFs
1133
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v2
14-
# Use GitHub Actions' cache to shorten build times and decrease load on servers
15-
- uses: actions/cache@v4
16-
with:
17-
path: vendor/bundle
18-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
19-
restore-keys: |
20-
${{ runner.os }}-gems-
21-
- name: Get build container
22-
id: adocbuild
23-
uses: avattathil/asciidoctor-action@master
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Setup Ruby
37+
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
38+
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
2439
with:
25-
program: "sh ./doc.sh"
26-
- name: Deploy docs to gh-pages
27-
uses: peaceiris/actions-gh-pages@v3
28-
with:
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
publish_branch: gh-pages
31-
publish_dir: ./docs/
32-
- uses: helaili/jekyll-action@v2
33-
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
35-
jekyll_src: "docs"
36-
target_branch: "gh-pages"
40+
ruby-version: "3.1" # Not needed with a .ruby-version file
41+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
42+
cache-version: 0 # Increment this number if you need to re-download cached gems
43+
- name: Setup Pages
44+
id: pages
45+
uses: actions/configure-pages@v5
46+
- name: Build with Jekyll
47+
# Outputs to the './_site' directory by default
48+
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
49+
env:
50+
JEKYLL_ENV: production
51+
- name: Upload artifact
52+
# Automatically uploads an artifact from the './_site' directory by default
53+
uses: actions/upload-pages-artifact@v3
54+
55+
# Deployment job
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build
62+
steps:
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: actions/deploy-pages@v4

docs/_includes/head.html

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
<head>
2-
<meta charset="utf-8">
3-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
4-
<meta name="viewport" content="width=device-width, initial-scale=1">
2+
<!-- Google tag (gtag.js) -->
3+
<script
4+
async
5+
src="https://www.googletagmanager.com/gtag/js?id=G-GH4HMEGEZD"
6+
></script>
7+
<script>
8+
window.dataLayer = window.dataLayer || [];
9+
function gtag() {
10+
dataLayer.push(arguments);
11+
}
12+
gtag("js", new Date());
13+
14+
gtag("config", "G-GH4HMEGEZD");
15+
</script>
16+
<meta charset="utf-8" />
17+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
18+
<meta name="viewport" content="width=device-width, initial-scale=1" />
519

620
<title>{{ page.title }}</title>
7-
<meta name="description" content="{{ page.description }}">
8-
<meta property="og:title" content="{{ page.title }}">
9-
<meta property="og:site_name" content="Viglet">
10-
<meta property="og:url" content="{{ page.url | absolute_url }}">
11-
<meta property="og:image" content="https://docs.viglet.com/static_files/img/banner.jpg" />
12-
<meta property="og:description" content="{{ page.description }}">
13-
<meta name="twitter:image:src" content="https://docs.viglet.com/static_files/img/banner.jpg">
14-
<meta name="twitter:card" content="summary_large_image">
15-
<meta name="twitter:site" content="@VigletTweet">
16-
<meta name="twitter:creator" content="@VigletTweet">
17-
<meta name="twitter:title" content="{{ page.title }}">
18-
<meta name="twitter:description" content="{{ page.description }}">
21+
<meta name="description" content="{{ page.description }}" />
22+
<meta property="og:title" content="{{ page.title }}" />
23+
<meta property="og:site_name" content="Viglet" />
24+
<meta property="og:url" content="{{ page.url | absolute_url }}" />
25+
<meta
26+
property="og:image"
27+
content="https://docs.viglet.com/static_files/img/banner.jpg"
28+
/>
29+
<meta property="og:description" content="{{ page.description }}" />
30+
<meta
31+
name="twitter:image:src"
32+
content="https://docs.viglet.com/static_files/img/banner.jpg"
33+
/>
34+
<meta name="twitter:card" content="summary_large_image" />
35+
<meta name="twitter:site" content="@VigletTweet" />
36+
<meta name="twitter:creator" content="@VigletTweet" />
37+
<meta name="twitter:title" content="{{ page.title }}" />
38+
<meta name="twitter:description" content="{{ page.description }}" />
1939
{%- include custom-head.html -%}
20-
</head>
40+
</head>

0 commit comments

Comments
 (0)