Skip to content

Commit ed0e535

Browse files
authored
Initial commit
0 parents  commit ed0e535

File tree

152 files changed

+6719
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+6719
-0
lines changed

.docker/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# start with official ruby docker image as base
2+
FROM ruby:3.1.2
3+
4+
# set working directory within container
5+
WORKDIR /usr/src/app
6+
7+
# pull in ruby (jekyll) and python (cite process) package info
8+
COPY Gemfile Gemfile.lock _cite/requirements.txt ./
9+
10+
# install ruby packages
11+
RUN VERSION=$(grep -A 1 'BUNDLED WITH' Gemfile.lock | tail -n 1 | xargs); \
12+
gem install bundler --version ${VERSION} && \
13+
bundle _${VERSION}_ install
14+
15+
# install python
16+
RUN apt update && apt install -y python3 python3-pip
17+
18+
# install python packages
19+
RUN python3 -m pip install --no-cache-dir --upgrade --requirement requirements.txt
20+
21+
# install python package for listening for file changes
22+
RUN pip install "watchdog[watchmedo]==3.0.0"
23+
24+
# ports used by jekyll
25+
EXPOSE 4000
26+
EXPOSE 35729
27+
28+
# run jekyll and cite process
29+
COPY .docker/entrypoint.sh /var
30+
CMD [ "/var/entrypoint.sh" ]

.docker/entrypoint.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#! /bin/bash
2+
3+
# print folder contents for debugging
4+
printf "\n\nContents:\n\n"
5+
ls
6+
7+
# run cite process
8+
python3 _cite/cite.py
9+
10+
# run jekyll serve in hot-reload mode
11+
# rerun whenever _config.yaml changes (jekyll hot-reload doesn't work with this file)
12+
watchmedo auto-restart \
13+
--debug-force-polling \
14+
--patterns="_config.yaml" \
15+
--signal SIGTERM \
16+
-- bundle exec jekyll serve --open-url --force_polling --livereload --trace --host=0.0.0.0 \
17+
| sed "s/LiveReload address.*//g;s/0.0.0.0/localhost/g" &
18+
19+
# rerun cite process whenever _data files change
20+
watchmedo shell-command \
21+
--debug-force-polling \
22+
--recursive \
23+
--wait \
24+
--command="python3 _cite/cite.py" \
25+
--patterns="_data/sources*;_data/orcid*;_data/pubmed*;_data/google-scholar*" \

.docker/run.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#! /bin/bash
2+
3+
# name of image
4+
IMAGE=lab-website-renderer:latest
5+
6+
# name of running container
7+
CONTAINER=lab-website-renderer
8+
9+
# choose platform flag
10+
PLATFORM=""
11+
12+
# default vars
13+
DOCKER_RUN="docker run"
14+
WORKING_DIR=$(pwd)
15+
16+
# fix windows faux linux shells/tools
17+
if [[ $OSTYPE == msys* ]] || [[ $OSTYPE == cygwin* ]]; then
18+
DOCKER_RUN="winpty docker run"
19+
WORKING_DIR=$(cmd //c cd)
20+
fi
21+
22+
# build docker image
23+
docker build ${PLATFORM} \
24+
--tag ${IMAGE} \
25+
--file ./.docker/Dockerfile . && \
26+
27+
# run built docker image
28+
${DOCKER_RUN} ${PLATFORM} \
29+
--name ${CONTAINER} \
30+
--init \
31+
--rm \
32+
--interactive \
33+
--tty \
34+
--publish 4000:4000 \
35+
--publish 35729:35729 \
36+
--volume "${WORKING_DIR}:/usr/src/app" \
37+
${IMAGE} "$@"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
body:
2+
- type: checkboxes
3+
attributes:
4+
label: Checks
5+
options:
6+
- label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first.
7+
required: true
8+
9+
- type: input
10+
id: repo
11+
attributes:
12+
label: Link to your website repo
13+
description: "In almost all cases, **we cannot help you if you don't provide this**."
14+
placeholder: ex. https://github.com/greenelab/greenelab.com
15+
validations:
16+
required: true
17+
18+
- type: input
19+
id: version
20+
attributes:
21+
label: Version of Lab Website Template you are using
22+
description: See your `CITATION.cff` file.
23+
placeholder: ex. 1.0.0
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
id: description
29+
attributes:
30+
label: Description
31+
description: |
32+
Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in?
33+
placeholder: Description
34+
validations:
35+
required: true

.github/DISCUSSION_TEMPLATE/q-a.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
body:
2+
- type: checkboxes
3+
attributes:
4+
label: Checks
5+
options:
6+
- label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first.
7+
required: true
8+
9+
- type: input
10+
id: repo
11+
attributes:
12+
label: Link to your website repo
13+
description: "In almost all cases, **we cannot help you if you don't provide this**."
14+
placeholder: ex. https://github.com/greenelab/greenelab.com
15+
validations:
16+
required: true
17+
18+
- type: input
19+
id: version
20+
attributes:
21+
label: Version of Lab Website Template you are using
22+
description: See your `CITATION.cff` file.
23+
placeholder: ex. 1.0.0
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
id: description
29+
attributes:
30+
label: Description
31+
description: |
32+
Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in?
33+
placeholder: Description
34+
validations:
35+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: 💬 Start a discussion
4+
url: https://github.com/greenelab/lab-website-template/discussions
5+
about: I need help, I have a question, or other discussion.
6+
- name: 📚 Docs issue
7+
url: https://github.com/greenelab/lab-website-template-docs/issues
8+
about: I have a question or issue related to the template documentation.

.github/ISSUE_TEMPLATE/issue.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 🐞 Create an issue
2+
description: I think I've discovered a bug, I want to request a feature/change, or other issue.
3+
4+
body:
5+
- type: checkboxes
6+
attributes:
7+
label: Checks
8+
options:
9+
- label: I have searched **[the docs](https://greene-lab.gitbook.io/lab-website-template-docs)**, [existing issues](https://github.com/greenelab/lab-website-template/issues), and [existing discussions](https://github.com/greenelab/lab-website-template/discussions) for answers first.
10+
required: true
11+
12+
- type: input
13+
id: repo
14+
attributes:
15+
label: Link to your website repo
16+
description: "In almost all cases, **we cannot help you if you don't provide this**."
17+
placeholder: ex. https://github.com/greenelab/greenelab.com
18+
validations:
19+
required: true
20+
21+
- type: input
22+
id: version
23+
attributes:
24+
label: Version of Lab Website Template you are using
25+
description: See your `CITATION.cff` file.
26+
placeholder: ex. 1.0.0
27+
validations:
28+
required: true
29+
30+
- type: textarea
31+
id: description
32+
attributes:
33+
label: Description
34+
description: |
35+
Describe your issue in as much detail as possible. For example: What happened? What did you expect to happen? How can we reproduce the problem? What browser are you seeing the problem in?
36+
placeholder: Description
37+
validations:
38+
required: true

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
STOP!!!
2+
3+
You are about to open this pull request against THE TEMPLATE ITSELF. You probably meant to open it against your own website repo.
4+
5+
---
6+
7+
FOR THE TEMPLATE MAINTAINER(S)
8+
9+
New template version checklist:
10+
11+
- [ ] I have updated CITATION and CHANGELOG as appropriate.
12+
- [ ] I have updated lab-website-template-docs as appropriate.
13+
- [ ] I have checked the testbed as appropriate.

.github/user_pull_request_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This website is based on the Lab Website Template.
2+
See its documentation for working with this site:
3+
4+
https://greene-lab.gitbook.io/lab-website-template-docs

.github/workflows/build-preview.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: build-preview
2+
run-name: build pull request preview
3+
4+
on:
5+
# run when called from another workflow
6+
workflow_call:
7+
8+
# run if user manually requests it
9+
workflow_dispatch:
10+
11+
# variables
12+
env:
13+
PREVIEWS_FOLDER: preview
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
build-preview:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Debug dump
25+
uses: crazy-max/ghaction-dump-context@v2
26+
27+
- name: Checkout branch contents
28+
uses: actions/checkout@v4
29+
with:
30+
repository: ${{ github.event.pull_request.head.repo.full_name }}
31+
ref: ${{ github.head_ref }}
32+
33+
- name: Install Ruby packages
34+
if: github.event.action != 'closed'
35+
uses: ruby/setup-ruby@v1
36+
with:
37+
ruby-version: "3.1"
38+
bundler-cache: true
39+
40+
- name: Get Pages url
41+
if: github.event.action != 'closed'
42+
id: pages
43+
uses: actions/configure-pages@v4
44+
45+
- uses: jwalton/gh-find-current-pr@master
46+
if: github.event.action != 'closed'
47+
id: pr
48+
with:
49+
state: all
50+
51+
- name: SSH debug
52+
if: runner.debug == '1'
53+
uses: mxschmitt/action-tmate@v3
54+
55+
- name: Build preview version of site
56+
if: github.event.action != 'closed'
57+
run: |
58+
JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ env.pr }}"
59+
env:
60+
pr: ${{ steps.pr.outputs.pr }}
61+
62+
- name: Commit preview to Pages branch
63+
uses: rossjrw/[email protected]
64+
with:
65+
source-dir: _site
66+
umbrella-dir: ${{ env.PREVIEWS_FOLDER }}

0 commit comments

Comments
 (0)