Skip to content

Commit

Permalink
Merge branch 'master' into 0103-poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
saracarl authored Jul 24, 2020
2 parents 618b172 + a7d03ff commit d6bde57
Show file tree
Hide file tree
Showing 45 changed files with 127,935 additions and 371 deletions.
21 changes: 21 additions & 0 deletions .github/bin/build_jekyll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

bundle config path vendor/bundle
if [ $? -eq 1 ];then
echo "Failed adding config path"
exit 1
fi

bundle install
if [ $? -eq 1 ];then
echo "Failed bundle install"
exit 1
fi

echo "Running config: $CONFIG"
bundle exec jekyll build --baseurl $BASE_URL $CONFIG
if [ $? -eq 1 ];then
echo "Failed jekyll build"
exit 1
fi

70 changes: 70 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is a basic workflow to help you get started with Actions

name: Deploy-live

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- run: gem install bundler

- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
# Build jekyll site
- name: Build Jekyll
run: .github/bin/build_jekyll.sh
env:
CONFIG: "--config _config.yml,_config_prod.yml"
BASE_URL: "/api/cookbook"

# Deploy to live site
- name: Create GitHub deployment
uses: glenrobson/[email protected]
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: production
- name: Deploy to S3
uses: glenrobson/[email protected]
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "iiif-api-website"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: "_site"
DEST_DIR: "api/cookbook"
- name: Update deployment status
uses: glenrobson/[email protected]
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: "https://iiif.io/api/cookbook/"
99 changes: 99 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This is a basic workflow to help you get started with Actions

name: Deploy-preview

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- '*'
- '!master'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# store branch name in ${BRANCH_NAME}
- uses: nelonoel/branch-name@v1

- name: Setup ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
- run: gem install bundler

- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
# Build jekyll site
- name: Build Jekyll
run: .github/bin/build_jekyll.sh
env:
CONFIG: "--config _config.yml"
BASE_URL: "/cookbook/${{ env.BRANCH_NAME}}"
# Validate
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: validate
run: scripts/validate.sh

# Deploy to live site
- name: Create GitHub deployment
uses: glenrobson/[email protected]
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: staging
- name: Deploy to S3
uses: glenrobson/[email protected]
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "preview.iiif.io"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: "_site"
DEST_DIR: "cookbook/${BRANCH_NAME}"
- name: Update deployment status
uses: glenrobson/[email protected]
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: "https://preview.iiif.io/cookbook/${{ env.BRANCH_NAME}}/index.html"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_site
*.swp
.ruby-version
presentation-validator
scripts/schema
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

34 changes: 16 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.4)
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.9.25)
ffi (1.12.2)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.8.5)
jekyll (3.8.6)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand All @@ -29,26 +29,24 @@ GEM
safe_yaml (~> 1.0)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-watch (2.1.2)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (1.17.0)
liquid (4.0.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
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)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (3.0.3)
rake (12.3.2)
public_suffix (4.0.3)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rouge (3.1.1)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.7.2)
rouge (3.17.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand Down
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,41 @@ This repository is the source location for the IIIF 3.0 recipes. The aim is to s

Please see the [Cookbook Process](recipe/index.md).

## Jekyll Variables
## Jekyll Variables and Templates

### In Jekyll .md files:

There are some includes that are helpful to ensure a consistent style between recipes. These include:

#### Include link to Viewers
This provides a standard link to the JSON and also to viewers. A full example is as follows:

```
{% include manifest_links.html viewers="UV, Mirador, Tify, Curation" manifest="manifest.json" %}
```

and this would produce the following line:

[JSON-LD]() | [View in Universal Viewer]() | [View in Mirador]() | [View in Tify]() | [View in IIIF Curation Viewer]()

The `manifest` parameter allows you to pass a relative link to the manifest and the `viewers` parameter is a list of Viewer links to show. Delete any viewers that don't support the recipe and remove the `viewers` parameter entirely if no viewers support the recipe.

#### Include JSON Viewer
This will embed a JavaScript JSON viewer which will show line numbers and format the JSON. A basic example is as follows:

```
{% include jsonviewer.html src="manifest.json" %}
```

Where `src` is the relative path to the JSON file. It is also possible to add a `config` parameter if you would like to customise the view further. An example of this is to highlight the first 5 lines:

```
{% include jsonviewer.html src="manifest.json" config='data-line="1-4"' %}
```

See the [prism.js](https://prismjs.com/#plugins) website for a full list of configuration options.

### In JSON files:

To make the process of making the manifests resolvable during all stages of the deployment (local, test and preview deployment) there are a number of Jekyll variables available for use in JSON files. These include:

Expand All @@ -27,9 +61,7 @@ https://fixtures.iiif.io/

The cookbook site is available at:

https://preview.iiif.io/cookbook/master

**Note:** in the future this will be merged into the https://iiif.io website.
https://iiif.io/api/cookbook/

## To build locally:

Expand All @@ -45,7 +77,7 @@ This repository can be viewed using the following pattern:

```https://preview.iiif.io/cookbook/<branch_name>/```

for all branches but master. For example see the themed version:
for all branches but master. For example to see the themed version:

[https://preview.iiif.io/cookbook/themed/](https://preview.iiif.io/cookbook/themed/)

6 changes: 4 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ defaults:
values:
layout: "recipe"
livesite: "https://iiif.io"

url: https://preview.iiif.io
markdown: kramdown
kramdown:
syntax_highlighter_opts:
disable : true

webrick:
headers:
Access-Control-Allow-Origin: "*"
exclude: ["scripts", "Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"]
2 changes: 2 additions & 0 deletions _config_prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

url: https://iiif.io
3 changes: 3 additions & 0 deletions _includes/jsonviewer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{: .line-numbers data-download-link data-download-link-label="Download me" data-src="{{include.src}}" {{include.config | default: ''}} }
```json
```
4 changes: 3 additions & 1 deletion _includes/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
[0002]: {{site.baseurl}}/recipe/0002-mvm-audio/ "Simplest Manifest - Audio"
[0003]: {{site.baseurl}}/recipe/0003-mvm-video/ "Simplest Manifest - Video"

[0068]: {{site.baseurl}}/recipe/0068-newspaper/ "A newspaper"

[prezi3]: https://iiif.io/api/presentation/3 "IIIF Presentation API"
[prezi3-languages]: https://iiif.io/api/presentation/3.0/#language-of-property-values "Language of Property Values"
[prezi3-languages]: https://iiif.io/api/presentation/3.0/#language-of-property-values "Language of Property Values"
2 changes: 2 additions & 0 deletions _includes/manifest_links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% assign viewers = include.viewers | split: "," %}
[JSON-LD]({{ include.manifest }}) {% for viewerTxt in viewers %}{% assign viewer = viewerTxt | strip %}| {% include viewer_link.html type=viewer manifest=include.manifest %}{% endfor %}
Loading

0 comments on commit d6bde57

Please sign in to comment.