Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Adds GH Pages Workflow #69

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
##
# Publish HTML to GH Pages
# - Runs the build script.
# - Moves relevant artifacts to publishing directory
# - Moves publishing directory contents to GH pages.
##

name: Publish to GH Pages

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: ls
- name: Build using Docker
run: /bin/bash ./build-docker.sh
- name: Move to Publish Directory
run: |
mkdir ./publish
mv ./build/PartiQL-Specification.html ./publish/index.html
mv ./build/images ./publish/
- name: Deploy to GH Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.vscode/
/.idea/

# build
build
Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ source 'https://rubygems.org'

gem 'rake'

gem 'asciidoctor'
gem 'asciidoctor-pdf'
gem 'asciidoctor-mathematical'
gem 'asciidoctor', '2.0.20'
gem 'asciidoctor-pdf', '2.3.9'
gem 'mathematical', '1.6.14'
gem 'asciidoctor-mathematical', '0.3.5'

gem 'prawn'
gem 'prawn-table', github: 'prawnpdf/prawn-table'
gem 'prawn-svg'
Expand Down
5 changes: 3 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ To build `HTML` and optimized `PDF`
bundle exec rake
```

=== Releasing

To perform a release, update `revnumber` and remove `revremark` in `src/main.adoc` in a single commit. Once updated, tag the commit. Then, update the `revnumber` and re-add `revremark` accordingly.


= License
== License

This library is licensed under the link:LICENSE[PartiQL Specification License].
10 changes: 5 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version_string = `git describe --tag | cut -d "-" -f 1,2 | tr - .`.chomp
if version_string.empty?
version_string = '0'
# Attempt to grab the date of the latest commit. If unable to, we use the current date.
Copy link

@am357 am357 Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the Conversation note:

I updated how we retrieve the date of publication. I now do it by the last git commit date -- this ensures that when we checkout a tag, we can run it, and it gives us consistent dates.

I know we have added this to the release process but will there be a situation where the latest commit is not corresponding to a tag, i.e., changes not released yet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, intentionally. So, when we automatically release to GH pages, it'll grab the tip-of-head's date. However, when we release a version, the exact commit will be tagged. Checking out that commit and running this will always give us the release date matching that of the tagged commit.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify further: so the page that we will see in the website is not necessarily the released version? if so, would it make sense to automate the release and as part of that publish for website?

date_string = `git log -1 --pretty='format:%cd' --date=format:'%Y-%m-%d'`.chomp
if date_string.empty?
date_string = Time.now.strftime("%Y-%m-%d")
johnedquinn marked this conversation as resolved.
Show resolved Hide resolved
end
date_string = Time.now.strftime("%Y-%m-%d")
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'"
params = "--attribute revdate='#{date_string}'"

image_files = Rake::FileList.new("src/images/*.png", "src/images/*.svg") do |fl|
fl.exclude("~*")
Expand Down
2 changes: 1 addition & 1 deletion build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ run_check docker build ${DOCKER_ARGS} -t ${IMAGE_TAG} \
--build-arg GROUP_ID=$(id -g) \
$(pwd)

run_check docker run ${DOCKER_ARGS} -it --rm \
run_check docker run ${DOCKER_ARGS} --rm \
--mount type=bind,source="$(pwd)",target=/workspace \
${IMAGE_TAG} /bin/bash --login docker-run.sh "$@"
7 changes: 4 additions & 3 deletions docker-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -e

BOOTSTRAP_DIR=${HOME}/bootstrap
RUBY_VERSION="3.2.2"

# Install rbenv
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
Expand All @@ -12,8 +13,8 @@ echo 'eval "$(~/.rbenv/bin/rbenv init - zsh)"' >> ~/.zshrc
eval "$(~/.rbenv/bin/rbenv init - bash)"

# Install latest stable Ruby
rbenv install $(rbenv install -l | grep -v - | tail -1)
rbenv global $(rbenv install -l | grep -v - | tail -1)
rbenv install ${RUBY_VERSION}
rbenv global ${RUBY_VERSION}

# Install our required Gems
cd ${BOOTSTRAP_DIR}
Expand All @@ -27,4 +28,4 @@ curl -L -o fonts/iosevka.zip https://github.com/be5invis/Iosevka/releases/downlo
unzip fonts/iosevka.zip -d fonts/iosevka

# Rake doesn't like the ownership of our workspace in the container
git config --global --add safe.directory /workspace
git config --global --add safe.directory /workspace
4 changes: 4 additions & 0 deletions src/main.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
The PartiQL Specification Committee
:doctype: book
:creator: {author}
:revnumber: v0.3.0-HEAD
:revremark: PRE-RELEASE
:copyright: Copyright ©2019 Amazon.com Inc. or Affiliates (“Amazon”)
:docinfo:
:sectnums:
:sectanchors:
:sectlinks:
:sectnumlevels: 5
:toc:
:toclevels: 4
Expand Down