Skip to content

Commit

Permalink
v1.1.0 (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti committed Mar 17, 2023
1 parent 9a69de4 commit 78fad78
Show file tree
Hide file tree
Showing 48 changed files with 531 additions and 215 deletions.
30 changes: 30 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# start with official ruby docker image as base
FROM ruby:3.1.2

# set working directory within container
WORKDIR /usr/src/app

# pull in ruby (jekyll) and python (cite process) package info
COPY Gemfile Gemfile.lock _cite/requirements.txt ./

# install ruby packages
RUN VERSION=$(grep -A 1 'BUNDLED WITH' Gemfile.lock | tail -n 1 | xargs); \
gem install bundler --version ${VERSION} && \
bundle _${VERSION}_ install

# install python
RUN apt update && apt install -y python3 python3-pip

# install python packages
RUN python3 -m pip install --upgrade --requirement requirements.txt

# install python package for listening for file changes
RUN pip install "watchdog[watchmedo]"

# ports used by jekyll
EXPOSE 4000
EXPOSE 35729

# run jekyll and cite process
COPY .docker/entrypoint.sh /var
CMD [ "/var/entrypoint.sh" ]
24 changes: 24 additions & 0 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /bin/bash

# print folder contents for debugging
echo "Contents:"
echo ""
ls
echo ""

# run jekyll serve in hot-reload mode.
# rerun whenever _config.yaml changes (jekyll hot-reload doesn't work with this file).
watchmedo auto-restart \
--debug-force-polling \
--patterns="_config.yaml" \
--signal SIGTERM \
-- bundle exec jekyll serve --open-url --force_polling --livereload --trace --host=0.0.0.0 \
| sed 's/0.0.0.0/localhost/g' &

# run cite process.
# rerun whenever _data files change.
watchmedo shell-command \
--debug-force-polling \
--recursive \
--command="python3 _cite/cite.py" \
--patterns="_data/sources*;_data/orcid*;_data/pubmed*;_data/google-scholar*" \
37 changes: 37 additions & 0 deletions .docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#! /bin/bash

# name of image
IMAGE=lab-website-renderer:latest

# name of running container
CONTAINER=lab-website-renderer

# choose platform flag
PLATFORM=""

# default vars
DOCKER_RUN="docker run"
WORKING_DIR=$(pwd)

# fix windows faux linux shells/tools
if [[ $OSTYPE == msys* ]] || [[ $OSTYPE == cygwin* ]]; then
DOCKER_RUN="winpty docker run"
WORKING_DIR=$(cmd //c cd)
fi

# build docker image
docker build ${PLATFORM} \
--tag ${IMAGE} \
--file ./.docker/Dockerfile . && \

# run built docker image
${DOCKER_RUN} ${PLATFORM} \
--name ${CONTAINER} \
--init \
--rm \
--interactive \
--tty \
--publish 4000:4000 \
--publish 35729:35729 \
--volume "${WORKING_DIR}:/usr/src/app" \
${IMAGE} "$@"
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ You are about to open this pull request against THE TEMPLATE ITSELF. You probabl

FOR THE TEMPLATE MAINTAINER(S)

Checklist:
New template version checklist:

- [ ] I have updated CITATION and CHANGELOG.
- [ ] I have updated CITATION and CHANGELOG as appropriate.
- [ ] I have updated lab-website-template-docs as appropriate.
- [ ] I have checked the testbed as appropriate.
2 changes: 1 addition & 1 deletion .github/workflows/build-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build preview version of site
if: github.event.action != 'closed'
run: |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ github.event.number }}"
JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}/${{ env.PREVIEWS_FOLDER }}/pr-${{ github.event.number }}"
- name: Commit preview to Pages branch
uses: rossjrw/pr-preview-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Build live version of site
run: |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}"
JEKYLL_ENV=production bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}"
- name: Commit live site to Pages branch
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
24 changes: 9 additions & 15 deletions .github/workflows/versioning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
.split(/^##?#?#?/m)
.map((section) => {
const [heading, ...body] = section.split("\n");
return [heading.trim(), body.join("\n").trim()];
return { heading, body: body.join("\n") };
});
// check version
Expand All @@ -71,8 +71,8 @@ jobs:
// check changelog
const newSection = changelog.find(
([heading, body]) =>
heading.includes(newVersion) && heading.includes(newDate) && body
({ heading, body }) =>
heading.includes(newVersion) && heading.includes(newDate) && body.trim()
);
if (!newSection) throw Error("Changelog not updated or not valid");
Expand Down Expand Up @@ -109,27 +109,21 @@ jobs:
.split(/^##?#?#?/m)
.map((section) => {
const [heading, ...body] = section.split("\n");
return [heading.trim(), body.join("\n").trim()];
return { heading, body: body.join("\n") };
});
// find changelog body for version
const body =
changelog.find(
([heading]) => heading.includes(version) && heading.includes(date)
({ heading }) => heading.includes(version) && heading.includes(date)
)?.body || "";
return { version, body };
- name: Create a tag
id: tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ fromJson(steps.version.outputs.result).version }}

- name: Create a GitHub release
- name: Create tag and GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ fromJson(steps.version.outputs.result).version }}
name: ${{ fromJson(steps.version.outputs.result).version }}
commit: ${{ github.ref }}
tag: v${{ fromJson(steps.version.outputs.result).version }}
name: v${{ fromJson(steps.version.outputs.result).version }}
body: ${{ fromJson(steps.version.outputs.result).body }}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

Reference: common-changelog.org

## 1.1.0 - 2023-03-17

Add alert component, Docker support, accessibility fixes.

### Changed

- Fix Lighthouse accessibility issues.
- De-href components when link isn't provided (no hand cursor icon on hover or nav on click).
- In search script, limit highlights by total count instead of char length.
- Grid and link style tweaks.
- Take ORCID icon from Font Awesome.
- Misc bug fixes in tags script, float component.

### Added

- Add Docker configuration and scripts for local previewing.
- Add alert component and types.
- Role icon in portrait component hoisted to top left.

## 1.0.0 - 2023-02-28

First official release.
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# citation metadata for the template itself

title: "Lab Website Template"
version: 1.0.0
date-released: 2023-02-28
version: 1.1.0
date-released: 2023-03-17
url: "https://github.com/greenelab/lab-website-template"
authors:
- family-names: "Rubinetti"
Expand Down
11 changes: 10 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ GEM
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.5)
ffi (1.15.5-x64-mingw-ucrt)
forwardable-extended (2.6.0)
gemoji (3.0.1)
google-protobuf (3.22.0-arm64-darwin)
google-protobuf (3.22.0-x64-mingw-ucrt)
http_parser.rb (0.8.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -59,6 +61,10 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.8.1)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.10-arm64-darwin)
racc (~> 1.4)
pathutil (0.16.2)
Expand All @@ -75,6 +81,8 @@ GEM
safe_yaml (1.0.5)
sass-embedded (1.58.3-arm64-darwin)
google-protobuf (~> 3.21)
sass-embedded (1.58.3-x64-mingw-ucrt)
google-protobuf (~> 3.21)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.4.2)
Expand All @@ -85,6 +93,7 @@ PLATFORMS
linux
universal-darwin-21
universal-darwin-22
x64-mingw-ucrt
x64-mingw32
x64-unknown
x86_64-linux
Expand All @@ -99,4 +108,4 @@ DEPENDENCIES
webrick (~> 1.7)

BUNDLED WITH
2.4.7
2.4.7
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Spend less time worrying about managing a website and citations, and more time r

👇👇 **Get Started** 👇👇

[**📚 Documentation 📚**](https://greene-lab.gitbook.io/lab-website-template-docs)
[**Documentation**](https://greene-lab.gitbook.io/lab-website-template-docs)

## Key Features

Expand Down
Binary file modified _cite/.cache/cache.db
Binary file not shown.
1 change: 0 additions & 1 deletion _config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ links:
google-scholar: ETJoidYAAAAJ
github: your-lab
twitter: YourLabHandle
instagram: YourLabHandle
youtube: YourLabChannel

### jekyll settings
Expand Down
4 changes: 2 additions & 2 deletions _data/citations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
plugin: sources.py
file: sources.yaml
type: paper
description: Lorem ipsum _dolor sit amet_, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
description: Lorem ipsum _dolor_ **sit amet**, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
image: https://journals.plos.org/ploscompbiol/article/figure/image?size=inline&id=info:doi/10.1371/journal.pcbi.1007128.g001&rev=2
buttons:
- type: manubot
Expand Down
2 changes: 1 addition & 1 deletion _data/sources.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- id: doi:10.1371/journal.pcbi.1007128
type: paper
description: Lorem ipsum _dolor sit amet_, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
description: Lorem ipsum _dolor_ **sit amet**, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
date: 2020-12-4
image: https://journals.plos.org/ploscompbiol/article/figure/image?size=inline&id=info:doi/10.1371/journal.pcbi.1007128.g001&rev=2
buttons:
Expand Down
28 changes: 27 additions & 1 deletion _data/types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ search:
# social media

orcid:
icon: orcid.svg
icon: fa-brands fa-orcid
text: ORCID
tooltip: ORCID
link: https://orcid.org/$VALUE
Expand Down Expand Up @@ -120,6 +120,32 @@ linkedin:
tooltip: LinkedIn
link: https://www.linkedin.com/in/$VALUE

# alerts

tip:
icon: fa-solid fa-lightbulb
color: "#d946ef"

help:
icon: fa-solid fa-circle-question
color: "#6366f1"

info:
icon: fa-solid fa-circle-info
color: "#0ea5e9"

success:
icon: fa-solid fa-circle-check
color: "#22c55e"

warning:
icon: fa-solid fa-circle-exclamation
color: "#F59E0B"

error:
icon: fa-solid fa-ban
color: "#ef4444"

# publications

paper:
Expand Down
10 changes: 10 additions & 0 deletions _includes/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% assign color = site.data.types[include.type].color | default: "#808080" %}
<div class="alert" style="--color: {{ color }}">
{% assign icon = site.data.types[include.type].icon
| default: "fa-solid fa-circle-info"
%}
{% include icon.html icon=icon %}
<div class="alert-content">
{{ include.content | markdownify }}
</div>
</div>
5 changes: 2 additions & 3 deletions _includes/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
{% if button.tooltip %}
data-tooltip="{{ button.tooltip }}"
{% endif %}
{% if include.style %}
data-style="{{ include.style }}"
{% endif %}
data-style="{{ include.style }}"
{% if include.flip %}
data-flip
{% endif %}
aria-label="{{ button.tooltip | default: button.icon | default: "button" }}"
>
{% include icon.html icon=button.icon %}
{% if button.text and button.text != "" %}
Expand Down
Loading

0 comments on commit 78fad78

Please sign in to comment.