-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,20 @@ | ||
# syntax=docker/dockerfile:1.4.2 | ||
|
||
FROM ubuntu:20.04 | ||
|
||
## Install requirements | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ | ||
apt-get install -y \ | ||
nodejs \ | ||
npm | ||
|
||
## Install ro-crate-html-js | ||
RUN npm install ro-crate-html-js | ||
ENV PATH "/node_modules/.bin:$PATH" | ||
|
||
## Copy code file from repo to Docker filesystem | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
## Code to run when the docker container starts | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains 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,15 @@ | ||
name: 'rocrate-to-html' | ||
description: 'This creates a preview html file from the rocrate json metadata file' | ||
inputs: | ||
crate_path: | ||
description: 'Path to ro-crate-metadata.json' | ||
required: false | ||
default: '.' | ||
outputs: | ||
preview: | ||
description: 'HTML preview of the RO Crate' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.crate_path }} |
This file contains 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,21 @@ | ||
# Github actions | ||
|
||
## Local action using Docker | ||
|
||
A local github action requires an [`action.yml`](action.yml) (in the root directory of the repo) which shows the tool to be used and its inputs and outputs. | ||
|
||
## The [Dockerfile](Dockerfile) | ||
|
||
This needs to copy an [`entrypoint.sh`](entrypoint.sh) file to the container and run it using an `ENTRYPOINT` command. `entrypoint.sh` contains the commands you want to run in the container. This is instead of building the `docker run` command yourself on a command line. | ||
|
||
## GitHub workflows | ||
|
||
In order to actually run the action, you also need a file in the `.github/workflows/` directory. The name of the file isn't important. | ||
|
||
This file details which actions trigger the workflow (e.g. push on a named branch) and which jobs to run. [Example file](rocrate_to_pages.yml) | ||
|
||
## Deploying html to github pages | ||
|
||
Use this [gh-pages-deploy](https://github.com/JamesIves/github-pages-deploy-action) action to deploy the html generated by the workflow. It will commit changes generated by previous steps to your `gh-pages` branch, and render them. | ||
|
||
In brief, this step goes at the end of your workflow. [YouTube tutorial](https://youtu.be/jBZfo2Mj1mY) |
This file contains 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,3 @@ | ||
#!/bin/sh -l | ||
rochtml $1/ro-crate-metadata.json | ||
echo "::set-output name=preview::ro-crate-preview.html" |
This file contains 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,22 @@ | ||
name: RoCrate to GitHub Pages | ||
on: | ||
push: | ||
branches: | ||
- test | ||
pull_request: | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-20.04 | ||
concurrency: ci-${{github.ref}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build RO Crate Preview | ||
uses: ./ # Uses an action in the root directory | ||
|
||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: . | ||
branch: gh-pages |