-
Notifications
You must be signed in to change notification settings - Fork 35
Add GitHub Action to Generate a WARC of Hosted Site #66
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
Open
ikreymer
wants to merge
6
commits into
iipc:master
Choose a base branch
from
ikreymer:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b95dd6a
add github action to generate WARC from repo
ikreymer b69a6e8
fix sed syntax in .github/workflows/warcit.yaml
ikreymer b8ee492
gh action workflow: add timestamp to filename, compute name from repo
ikreymer cfb6823
fix typo in workflow
ikreymer 6262ef9
Add ability to trigger WARC build from any commit
ikreymer 48f380c
fix typo: should be site.baseurl not site.url
ikreymer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | ||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.