Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 7 additions & 12 deletions .github/workflows/build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@ jobs:
git fetch origin main --depth 1
git branch

# Use GitHub Actions' cache to shorten build times and decrease load on servers
- name: Use cache to shorten build time
uses: actions/cache@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Build Jekyll site
uses: helaili/jekyll-action@v2
with:
build_only: true
build_dir: _site
- name: Build with Jekyll
run: bundle exec jekyll build
env:
JEKYLL_ENV: production

- name: Check links with lychee
id: lychee
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneakers-the-rat i didn't know there was a $default-branch variable for actions. gosh that would have saved me a lot of time when we did the updates master --> main branch forever ago.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait actually idk if this works lmao I think that might need to be a literal, but the sample action had this in it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 so i'm not sure it does?? https://github.com/pyOpenSci/pyopensci.github.io/actions/workflows/gh-pages.yml

when i look at that this build after directly commiting a small change to main 🙈 it wasn't triggered
Screenshot 2024-07-23 at 4 49 21 PM

but what did get triggered is this action

could that be because i have github pages "turned on " in the repo settings somewhere? it's odd because the "pages" tab says this:
Screenshot 2024-07-23 at 4 50 45 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes - sorry, so yeah that should be replaced by main, and then you go to the pages setting and switch it from "deploy from branch" to "github action" . we just did this switch for our lab website and after that it worked without fuss


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ all_contribs.pickle
.vale.ini
styles/*
tmp/*
.bundle
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also didn't know you could pin the ruby version. gosh learning so much.

12 changes: 11 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
source "https://rubygems.org"

gem "github-pages", group: :jekyll_plugins
gem "jekyll-include-cache"
gem "webrick"
gem "html-proofer"
gem "ffi", "= 1.16.3"

gem "jekyll", "~>4.3.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneakers-the-rat i am going to merge this but i have a question.

You may have said this in the pr header but i want to be clear about what this does!
Is going this route going to allow us to avoid that github pages restriction of using other jekyll plugins and gems if we can also write our own? I just know that for a while that has also been a constraint for the site.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! We can add whatever gems we want here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay!!


group :jekyll_plugins do
gem "jekyll-paginate", "~> 1.1"
gem "jekyll-sitemap", "~> 1.4"
gem "jekyll-gist", "~> 1.5"
gem "jekyll-feed", "~> 0.17.0"
gem "jemoji", "~> 0.13.0"
gem "jekyll-redirect-from", "~> 0.16.0"
end
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ kramdown:
sass:
sass_dir: _sass
style: compressed # http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh does this automagically minify the css?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as much as css can be minified! (it doesn't eg. simplify rules afaik, and you can't do the javascript thing of replacing all names with single characters, yes it does remove as much as it can https://sass-lang.com/documentation/cli/dart-sass/#style )

quiet_deps: true

# Outputting
permalink: /:categories/:title/
Expand Down