Skip to content

Use GitHub Actions #78

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
74 changes: 74 additions & 0 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# 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

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.142.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
hugo \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public

# 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
Comment on lines +71 to +74
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK we don't use GitHub pages for clash-lang.io.

Copy link
Member Author

Choose a reason for hiding this comment

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

What are you trying to achieve? Was anything wrong with the Netlify integration?

There was nothing wrong with it in particular. I just found the GitHub Actions Integration much cleaner in terms of maintainability (the travis.yml looks a bit hacked together, to be honest). It worked out of the box for clash-formal.org, even with the latest hugo, so I thought it might be desirable to use it here as well.

Note that this template is completely provided as is by GitHub Pages. The only thing I changed was the version of hugo.

AFAIK we don't use GitHub pages for clash-lang.io.

I have no clue what we use. It's hard to deduce that from the content of the repo.

Copy link
Member

Choose a reason for hiding this comment

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

Oh gotcha, the Travis stuff is unused. We're just using Netlify integration.

34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

22 changes: 11 additions & 11 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
baseurl = "https://clash-lang.org/"
title = "Clash"
languageCode = "en-us"
paginate = "10"
pagination.pagerSize = "10"
theme = "mainroad"
disqusShortname = "clash-lang" # Enable comments by entering your Disqus shortname
googleAnalytics = "" # Enable Google Analytics by entering your tracking id
Expand All @@ -15,23 +15,23 @@ pygmentsStyle = "tango"
unsafe= true

[Params]
subtitle = "From Haskell to hardware"
subtitle = "From Haskell to hardware"
description = ""
opengraph = true
opengraph = true
twitter_cards = false
readmore = true
leftsidebar = false
authorbox = true
post_navigation = true
leftsidebar = false
authorbox = true
post_navigation = true

mathjax = true
mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js"
mathjaxConfig = "TeX-MML-AM_HTMLorMML"

#mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # <- Default

# change the format of dates
#dateformat = "2006-01-02"
dateformat = "2006-01-02"

[Params.widgets]
search = true # Enable "Search" widget
Expand Down Expand Up @@ -69,14 +69,14 @@ unsafe= true

[[menu.main]]
identifier = "documentation"
name = "Documentation"
name = "Documentation"
pre = ""
url = "/documentation/"
weight = 50

[[menu.main]]
identifier = "publications"
name = "Publications"
name = "Publications"
pre = ""
url = "/publications/"
weight = 40
Expand Down
2 changes: 1 addition & 1 deletion themes/mainroad/layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if and .Site.DisqusShortname (not (or .Site.Params.disable_comments .Params.disable_comments)) }}
{{ if and .Site.Config.Services.Disqus.Shortname (not (or .Site.Params.disable_comments .Params.disable_comments)) }}
<section class="comments">
{{ template "_internal/disqus.html" . }}
</section>
Expand Down