Skip to content

Commit

Permalink
First official version (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti authored Feb 27, 2023
1 parent ad4a6eb commit 9a69de4
Show file tree
Hide file tree
Showing 216 changed files with 4,830 additions and 4,220 deletions.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: 💬 Start a discussion
url: https://github.com/greenelab/lab-website-template/discussions
about: I need help, I have a question, or other discussion.
- name: 📚 Docs issue
url: https://github.com/greenelab/lab-website-template-docs/issues
about: I have a question or issue related to the template documentation.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 🐞 Create an issue
description: I think I've discovered a bug, I want to request a feature/change, or other issue.

body:
- type: checkboxes
attributes:
label: Checks
options:
- 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.
required: true

- type: input
id: repo
attributes:
label: Link to your website repo
description: "**Strongly recommended** so we can help troubleshoot your issue."
placeholder: ex. https://github.com/greenelab/greenelab.com

- type: input
id: version
attributes:
label: Version of Lab Website Template you are using
description: See your `CITATION.cff` file.
placeholder: ex. 1.0.0

- type: textarea
id: description
attributes:
label: Description
description: |
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?
placeholder: Description
validations:
required: true
15 changes: 10 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<!--
STOP!!!

This website is built upon Lab Website Template.
Please read its documentation carefully before submitting your changes:
You are about to open this pull request against THE TEMPLATE ITSELF. You probably meant to open it against your own website repo.

https://github.com/greenelab/lab-website-template/wiki
---

-->
FOR THE TEMPLATE MAINTAINER(S)

Checklist:

- [ ] I have updated CITATION and CHANGELOG.
- [ ] I have updated lab-website-template-docs as appropriate.
- [ ] I have checked the testbed as appropriate.
40 changes: 0 additions & 40 deletions .github/workflows/auto-cite.yaml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/build-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build-preview
run-name: build pull request preview

on:
# run when called from another workflow
workflow_call:

# run if user manually requests it
workflow_dispatch:

# variables
env:
PREVIEWS_FOLDER: preview

permissions:
contents: write
pull-requests: write

jobs:
build-preview:
runs-on: ubuntu-latest

steps:
- name: Print contexts
uses: crazy-max/ghaction-dump-context@v1

- name: Checkout branch contents
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}

- name: Install Ruby packages
if: github.event.action != 'closed'
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
bundler-cache: true

- name: Get Pages url
if: github.event.action != 'closed'
id: pages
uses: actions/configure-pages@v2
with:
enablement: false

- 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 }}"
- name: Commit preview to Pages branch
uses: rossjrw/pr-preview-action@v1
with:
source-dir: _site
umbrella-dir: ${{ env.PREVIEWS_FOLDER }}
50 changes: 50 additions & 0 deletions .github/workflows/build-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: build-site
run-name: build live site

on:
# run when called from another workflow
workflow_call:

# run if user manually requests it
workflow_dispatch:

# variables
env:
PREVIEWS_FOLDER: preview

permissions:
contents: write

jobs:
build-site:
runs-on: ubuntu-latest

steps:
- name: Print contexts
uses: crazy-max/ghaction-dump-context@v1

- name: Checkout branch contents
uses: actions/checkout@v3

- name: Install Ruby packages
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
bundler-cache: true

- name: Get Pages url
id: pages
uses: actions/configure-pages@v2
with:
enablement: false

- name: Build live version of site
run: |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path || '' }}"
- name: Commit live site to Pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _site
clean-exclude: ${{ env.PREVIEWS_FOLDER }}
force: false
111 changes: 111 additions & 0 deletions .github/workflows/first-time-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: first-time-setup
run-name: first time setup of repo

on:
# run if user manually requests it
workflow_dispatch:

permissions:
contents: write

jobs:
first-time-setup:
runs-on: ubuntu-latest

steps:
- name: Print contexts
uses: crazy-max/ghaction-dump-context@v1

- name: Create Pages branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "gh-pages"

- name: Checkout Pages branch
uses: actions/checkout@v3
with:
ref: gh-pages

- name: Clear Pages branch
run: rm -rf * .github .gitignore

- name: Make .nojekyll file
run: touch .nojekyll

- name: Make placeholder homepage
run: echo "Placeholder homepage" > index.html

- name: Commit changes to Pages branch
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: gh-pages
commit_message: "Clear branch"

- name: Checkout main branch
uses: actions/checkout@v3

- name: Remove unneeded files
run: |
rm -rf \
README.md \
CHANGELOG.md \
testbed.md \
.github/ISSUE_TEMPLATE \
.github/workflows/versioning.yaml \
.github/pull_request_template.md \
- name: Set vars for personalization
run: |
user="${{ github.repository_owner }}"
description="An engaging 1-3 sentence description of your lab."
echo "USER=${user}" >> $GITHUB_ENV
echo "DESCRIPTION=${description}" >> $GITHUB_ENV
- name: Personalize readme for user
run: |
echo "
# ${{ env.USER }}'s Website
Visit **[website url](#)** 🚀
_Built with [Lab Website Template](https://greene-lab.gitbook.io/lab-website-template-docs)_
" > README.md
- name: Install packages
run: yarn add yaml

- name: Personalize Jekyll config for user
uses: actions/github-script@v6
with:
script: |
const { readFileSync, writeFileSync } = require("fs");
const { parse, stringify } = require("yaml");
const file = "_config.yaml";
const config = parse(readFileSync(file).toString());
config.title = "${{ env.USER }}";
config.description = "${{ env.DESCRIPTION }}";
config.email = "contact@${{ env.USER }}.com";
config.github = "${{ env.USER }}";
config.twitter = "${{ env.USER }}";
config.instagram = "${{ env.USER }}";
config.youtube = "${{ env.USER }}";
writeFileSync(file, stringify(config));
- name: Personalize homepage for user
uses: actions/github-script@v6
with:
script: |
const { readFileSync, writeFileSync } = require("fs");
const file = "index.md";
let contents = readFileSync(file).toString();
const find = /\# Lab Website Template[\s\S]+({% include section\.html)/;
const replace = `# ${{ env.USER }}'s Website\n\n${{ env.DESCRIPTION }}\n\n$1`;
contents = contents.replace(find, replace);
writeFileSync(file, contents);
- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Setup repo"
27 changes: 27 additions & 0 deletions .github/workflows/on-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: on-pages
run-name: on pages deploy

on:
workflow_run:
workflows: [pages-build-deployment]
types:
- completed
branches:
- gh-pages

# run if user manually requests it
workflow_dispatch:

permissions:
contents: write

jobs:
update-url:
# only run on user instance of template, not template itself
if: github.repository != 'greenelab/lab-website-template'
uses: ./.github/workflows/update-url.yaml

build-site:
needs: update-url
if: needs.update-url.outputs.changed == 'true'
uses: ./.github/workflows/build-site.yaml
22 changes: 22 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: on-pull-request
run-name: on pull request activity

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- closed

permissions:
contents: write
pull-requests: write

jobs:
update-citations:
uses: ./.github/workflows/update-citations.yaml

build-preview:
needs: update-citations
uses: ./.github/workflows/build-preview.yaml
24 changes: 24 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: on-push
run-name: on push to main

on:
push:
branches:
- main

# run if user manually requests it
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update-citations:
# skip first run because nothing enabled or setup yet
if: github.run_number != 1
uses: ./.github/workflows/update-citations.yaml

build-site:
needs: update-citations
uses: ./.github/workflows/build-site.yaml
Loading

0 comments on commit 9a69de4

Please sign in to comment.