Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.0 First official version #159

Merged
merged 15 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved

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.

52 changes: 52 additions & 0 deletions .github/workflows/build-preview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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

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 }}
47 changes: 47 additions & 0 deletions .github/workflows/build-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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

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
116 changes: 116 additions & 0 deletions .github/workflows/first-time-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: first-time-setup
run-name: first time setup of repo

on:
# run when called from another workflow
workflow_call:

# run if user manually requests it
workflow_dispatch:

permissions:
contents: write
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved

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 \
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved

- name: Set vars for personalization
run: |
name="${{ github.repository_owner }}"
title="${name^}'s Website"
description="An engaging 1-3 sentence description of your lab."
echo "NAME=${name}" >> $GITHUB_ENV
echo "TITLE=${title}" >> $GITHUB_ENV
echo "DESCRIPTION=${description}" >> $GITHUB_ENV

- name: Personalize readme for user
vincerubinetti marked this conversation as resolved.
Show resolved Hide resolved
run: |
echo "
# ${{ env.TITLE }}

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.TITLE }}";
config.description = "${{ env.DESCRIPTION }}";
config.email = "contact@${{ env.name }}.com";
config.github = "${{ env.name }}";
config.twitter = "${{ env.name }}";
config.instagram = "${{ env.name }}";
config.youtube = "${{ env.name }}";
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)/g;
const replace = `# ${{ env.TITLE }}\n\n${{ env.DESCRIPTION }}\n\n$1`;
contents = contents.replaceAll(find, replace);
writeFileSync(file, contents);

- name: Commit changed files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Setup repo"
24 changes: 24 additions & 0 deletions .github/workflows/on-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: on-pages
run-name: on pages deploy

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

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
20 changes: 20 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: on-push
run-name: on push to main

on:
push:
branches:
- main

permissions:
contents: 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