Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action to Generate a WARC of Hosted Site #66

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/warcit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Generate WARC of Hosted Site

on:
push:
branches:
- master
workflow_dispatch:
inputs:
ref:
description: 'Checkout Git reference'
required: true
default: 'HEAD'

ikreymer marked this conversation as resolved.
Show resolved Hide resolved
jobs:
jekyll:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Checkout supplied Git reference
if: github.event_name == 'workflow_dispatch'
run: git checkout ${{ github.event.inputs.ref }}
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6 # can change this to 2.7 or whatever version you prefer

- name: install dependencies & build site
uses: limjh16/jekyll-action-ts@v2
with:
enable_cache: true
### Enables caching. Similar to https://github.com/actions/cache.
#
# format_output: true
### Uses prettier https://prettier.io to format jekyll output HTML.
#
# prettier_opts: '{ "useTabs": true }'
### Sets prettier options (in JSON) to format output HTML. For example, output tabs over spaces.
### Possible options are outlined in https://prettier.io/docs/en/options.html
#
# prettier_ignore: 'about/*'
### Ignore paths for prettier to not format those html files.
### Useful if the file is exceptionally large, so formatting it takes a while.
### Also useful if HTML compression is enabled for that file / formatting messes it up.
#
# jekyll_src: sample_site
### If the jekyll website source is not in root, specify the directory. (in this case, sample_site)
### By default, this is not required as the action searches for a _config.yml automatically.
#
# gem_src: sample_site
### By default, this is not required as the action searches for a _config.yml automatically.
### However, if there are multiple Gemfiles, the action may not be able to determine which to use.
### In that case, specify the directory. (in this case, sample_site)
###
### If jekyll_src is set, the action would automatically choose the Gemfile in jekyll_src.
### In that case this input may not be needed as well.
#
# key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
# restore-keys: ${{ runner.os }}-gems-
### In cases where you want to specify the cache key, enable the above 2 inputs
### Follows the format here https://github.com/actions/cache

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: warcit
run: |
pip install warcit
# if CNAME is present, use that as the site prefix
if (test -a CNAME); then
PREFIX="https://$(cat CNAME)/";
# otherwise, determine prefix from [organization]/[repo] in GITHUB_REPOSITORY and insert .github.io to make it [organization].github.io/[repo]
else
PREFIX="https://$(echo $GITHUB_REPOSITORY | sed 's|/|.github.io/|')/"
fi

export TIMESTAMP=$(date +%Y%m%d%H%M%S)
export FILENAME="$(echo $GITHUB_REPOSITORY | sed 's|/|-|')-$TIMESTAMP.warc.gz"
warcit -v "$PREFIX" -n ./$FILENAME ./_site/

echo "::set-env name=FILENAME::$FILENAME"


- name: upload WARC
uses: actions/upload-artifact@v1
with:
name: ${{ env.FILENAME }}
path: ./${{ env.FILENAME }}

#- name: deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./_site
# if the repo you are deploying to is <username>.github.io, uncomment the line below.
# if you are including the line below, make sure your source files are NOT in the master branch:
# publish_branch: master
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'
gem "jekyll", "~> 4.0.0"
gem 'jekyll-redirect-from'
gem "minima", "~> 2.5"
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.13.0"
end

80 changes: 80 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.6)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.13.1)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
jekyll (4.0.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (>= 0.9.5, < 2)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-feed (0.13.0)
jekyll (>= 3.7, < 5.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.6.1)
jekyll (>= 3.3, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.5)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.21.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)

PLATFORMS
ruby

DEPENDENCIES
jekyll (~> 4.0.0)
jekyll-feed (~> 0.13.0)
jekyll-redirect-from
minima (~> 2.5)

BUNDLED WITH
2.1.2
4 changes: 2 additions & 2 deletions _includes/_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="panel-body">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="{{site.baseurl}}/assets/javascripts/jquery.min.js"></script>
<div id="github-issues-widget"></div>
<script type="text/javascript">
GITHUB_ISSUES_USER = "iipc";
Expand Down Expand Up @@ -57,4 +57,4 @@ GithubIssuesWidget.go = function () {
};
GithubIssuesWidget.go();
</script>
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h1 class="nocount">{{ page.title }}{%if page.version %} {{ page.version }}{% en
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="{{site.baseurl}}/assets/javascripts/jquery.min.js"></script>
<script src="{{site.baseurl}}/assets/bootstrap/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{site.baseurl}}/assets/bootstrap/js/ie10-viewport-bug-workaround.js"></script>
Expand Down
4 changes: 4 additions & 0 deletions assets/javascripts/jquery.min.js

Large diffs are not rendered by default.