Skip to content

Commit

Permalink
add gh pages workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cakemanny committed Nov 15, 2024
1 parent 146662b commit 738b8cf
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Build and Deploy to GitHub Pages"
# Based on https://docs.github.com/en/pages/getting-started-with-github-pages/using-custom-workflows-with-github-pages

on:
pull_request:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install dependencies
run: |
gem install -g dependencies/Gemfile
- run: |
mkdir _site
cp -r spec _site/spec
make -C _site/spec
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site/

deploy:
if: github.ref == 'refs/heads/main'
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions dependencies/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'asciidoctor'
3 changes: 3 additions & 0 deletions dependencies/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Dependency files for build processes

Used by workflows in .github/workflows
12 changes: 11 additions & 1 deletion spec/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

TARGETS = d16n-v1_0.html latest.html

.PHONY: all
all: d16n-v1_0.html
all: $(TARGETS)

.PHONY: preview
preview: d16n-v1_0.html
Expand All @@ -9,3 +11,11 @@ preview: d16n-v1_0.html

d16n-v1_0.html: d16n-v1_0.adoc
asciidoctor $<

latest.html: d16n-v1_0.html
cp $< $@


.PHONY: clean
clean:
$(RM) $(TARGETS)
14 changes: 14 additions & 0 deletions spec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Tools

### `asciidoctor`

You may find it useful to [install][adoc-install] `asciidoctor` to build locally.

[adoc-install]: https://docs.asciidoctor.org/asciidoctor/latest/install/

Unless the world has changed, it's likely a case of
- `brew install asciidoctor` on macOS
- `sudo apt-get install asciidoctor` on Ubuntu or
- `nix-shell -p asciidoctor` on NixOS

There's probably also a preview extension for your editor.

0 comments on commit 738b8cf

Please sign in to comment.