Skip to content

Commit 27fa6d8

Browse files
authored
Updates (#195)
Update - Github Workflow to dynamically gather baseURL during build (to set automatically for dynamic domain name and ease of testing) - Handle missing image more gracefully (placeholder could be more generic)
1 parent 3050e4f commit 27fa6d8

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

.github/workflows/main.yml

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,79 @@
1-
# Sample workflow for building and deploying a Hugo site to GitHub Pages
21
name: Deploy Hugo site to Pages
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
75
branches: ["main"]
86

9-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
107
permissions:
118
contents: read
129
pages: write
1310
id-token: write
1411

15-
# Environment variables available to all jobs and steps in this workflow
1612
env:
1713
HUGO_ENV: production
1814
HUGO_VERSION: "0.118.2"
1915
GO_VERSION: "1.20.5"
2016
NODE_VERSION: "18.15.0"
21-
TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }}
22-
TINA_TOKEN: ${{ vars.TINA_TOKEN }}
2317

2418
jobs:
25-
# Build job
2619
build:
27-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-24.04-arm
2821
steps:
29-
- uses: actions/checkout@v3
30-
- name: Set up Node.js
31-
uses: actions/setup-node@v3
32-
with:
33-
node-version: ${{ env.NODE_VERSION }}
34-
3522
- name: Install Hugo
3623
run: |
37-
curl -LO "https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz"
38-
tar -xvf hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz
39-
sudo mv hugo /usr/local/bin/
40-
rm hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz
41-
hugo version
24+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-arm64.deb \
25+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
4226
4327
- name: Install Go
4428
run: |
45-
curl -LO "https://dl.google.com/go/go${{ env.GO_VERSION }}.linux-amd64.tar.gz"
46-
sudo tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-amd64.tar.gz
47-
echo "export PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV
48-
rm go${{ env.GO_VERSION }}.linux-amd64.tar.gz
49-
go version
29+
wget -O ${{ runner.temp }}/go.deb https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz \
30+
&& sudo tar -C /usr/local -xzf ${{ runner.temp }}/go.deb
31+
32+
- name: Checkout
33+
uses: actions/checkout@v4.2.2
34+
with:
35+
submodules: recursive
36+
fetch-depth: 0
37+
38+
- name: Setup Pages
39+
id: pages
40+
uses: actions/configure-pages@v5
5041

5142
- name: Setup Project
5243
run: npm run project-setup
5344

5445
- name: Install npm dependencies
5546
run: npm install
5647

57-
- name: Publish to GitHub Pages
48+
- name: Determine Base URL
49+
id: base_url
50+
run: |
51+
REPO_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f 2)
52+
if [[ "${{ github.repository_owner }}" == "${{ github.repository_owner }}" ]]; then
53+
BASE_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/"
54+
else
55+
BASE_URL="https://${{ github.repository_owner }}.github.io/"
56+
fi
57+
echo "BASE_URL=$BASE_URL" >> $GITHUB_ENV
58+
59+
- name: Modify hugo.toml
60+
run: sed -i "s|baseURL = .*|baseURL = \"$BASE_URL\"|" hugo.toml
61+
62+
- name: Build site
5863
run: npm run build
5964

6065
- name: Upload artifact
61-
uses: actions/upload-pages-artifact@v3
66+
uses: actions/upload-pages-artifact@v3.0.1
6267
with:
6368
path: ./public
6469

65-
# Deployment job
6670
deploy:
6771
environment:
6872
name: github-pages
6973
url: ${{ steps.deployment.outputs.page_url }}
70-
runs-on: ubuntu-latest
74+
runs-on: ubuntu-24.04-arm
7175
needs: build
7276
steps:
7377
- name: Deploy to GitHub Pages
7478
id: deployment
75-
uses: actions/deploy-pages@v2
79+
uses: actions/deploy-pages@v4.0.5

hugo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###################### default configuration ####################
22
# The base URL of your site (required). This will be prepended to all relative URLs.
3-
baseURL = "https://open-neuromorphic.org"
4-
#baseURL = "https://onm-demo.aimodels.org"
3+
# baseURL = "https://open-neuromorphic.org"
4+
baseURL = "https://neural-loop.github.io/open-neuromorphic.github.io/"
55
# Title of your website (required).
66
title = "Open Neuromorphic"
77

0 commit comments

Comments
 (0)