2024-01-21 19:04:17 +00:00
|
|
|
name: Deploy to Neocities
|
2024-01-21 03:38:40 +00:00
|
|
|
|
|
|
|
# only run on changes to main
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
concurrency: # prevent concurrent deploys doing strange things
|
|
|
|
group: deploy-to-neocities
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
# Default to bash
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
2024-01-21 19:23:28 +00:00
|
|
|
build:
|
|
|
|
name: Build Hugo site
|
2024-01-21 05:15:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-01-21 03:38:40 +00:00
|
|
|
steps:
|
2024-01-21 20:58:23 +00:00
|
|
|
- name: Hugo setup
|
|
|
|
uses: peaceiris/actions-hugo@v2.6.0
|
|
|
|
with:
|
|
|
|
hugo-version: '0.121.1'
|
|
|
|
extended: true
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Install Node.js dependencies
|
|
|
|
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
|
|
|
- name: Build with Hugo
|
2024-01-21 21:12:41 +00:00
|
|
|
run: hugo --minify
|
2024-01-21 19:04:43 +00:00
|
|
|
- name: Insert 404 page
|
|
|
|
run: |
|
|
|
|
cp public/not_found/index.html public/not_found.html
|
2024-01-21 19:23:28 +00:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-01-21 20:36:57 +00:00
|
|
|
name: build
|
2024-01-21 19:23:28 +00:00
|
|
|
path: public
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
highlight:
|
|
|
|
name: Highlight code with Torchlight
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
2024-01-21 20:32:08 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: Install Node.js dependencies
|
|
|
|
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
2024-01-21 19:23:28 +00:00
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
2024-01-21 20:36:57 +00:00
|
|
|
name: build
|
2024-01-21 19:23:28 +00:00
|
|
|
path: public
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Highlight with Torchlight
|
2024-01-21 13:59:53 +00:00
|
|
|
run: |
|
|
|
|
npm i @torchlight-api/torchlight-cli
|
|
|
|
npx torchlight
|
2024-01-21 19:23:28 +00:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-01-21 20:36:57 +00:00
|
|
|
name: highlight
|
2024-01-21 19:23:28 +00:00
|
|
|
path: public
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
name: Publish to Neocities
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: highlight
|
|
|
|
steps:
|
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
2024-01-21 20:36:57 +00:00
|
|
|
name: highlight
|
2024-01-21 19:23:28 +00:00
|
|
|
path: public
|
2024-01-21 03:38:40 +00:00
|
|
|
- name: Deploy to neocities
|
|
|
|
uses: bcomnes/deploy-to-neocities@v1
|
|
|
|
with:
|
|
|
|
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
|
2024-01-21 04:01:44 +00:00
|
|
|
cleanup: false
|
2024-01-21 03:38:40 +00:00
|
|
|
dist_dir: public
|