From a58119ea21690e1e52a40e55ee8d8b96b999578b Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Tue, 23 Jan 2024 13:07:54 -0600 Subject: [PATCH] configure preview builds on neocities --- .../workflows/deploy-preview-to-neocities.yml | 46 +++++++++++++++++++ config/preview/hugo.toml | 1 + config/preview/params.toml | 2 + 3 files changed, 49 insertions(+) create mode 100644 .github/workflows/deploy-preview-to-neocities.yml create mode 100644 config/preview/hugo.toml create mode 100644 config/preview/params.toml diff --git a/.github/workflows/deploy-preview-to-neocities.yml b/.github/workflows/deploy-preview-to-neocities.yml new file mode 100644 index 0000000..6979ac9 --- /dev/null +++ b/.github/workflows/deploy-preview-to-neocities.yml @@ -0,0 +1,46 @@ +name: Deploy to Neocities + +# only run on changes to preview +on: + push: + branches: + - preview + +concurrency: # prevent concurrent deploys doing strange things + group: deploy-preview-to-neocities + cancel-in-progress: true + +# Default to bash +defaults: + run: + shell: bash + +jobs: + deploy: + name: Build and deploy Hugo site + runs-on: ubuntu-latest + steps: + - name: Hugo setup + uses: peaceiris/actions-hugo@v2.6.0 + with: + hugo-version: '0.121.1' + extended: true + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build with Hugo + run: hugo --minify + - name: Insert 404 page + run: | + cp public/404/index.html public/not_found.html + - name: Highlight with Torchlight + run: | + npm i @torchlight-api/torchlight-cli + npx torchlight + - name: Deploy to Neocities + uses: bcomnes/deploy-to-neocities@v1 + with: + api_token: ${{ secrets.NEOCITIES_PREVIEW_API_TOKEN }} + cleanup: true + dist_dir: public \ No newline at end of file diff --git a/config/preview/hugo.toml b/config/preview/hugo.toml new file mode 100644 index 0000000..8936b1b --- /dev/null +++ b/config/preview/hugo.toml @@ -0,0 +1 @@ +baseURL = "https://preview--runtimeterror.neocities.org/" \ No newline at end of file diff --git a/config/preview/params.toml b/config/preview/params.toml new file mode 100644 index 0000000..c8a1743 --- /dev/null +++ b/config/preview/params.toml @@ -0,0 +1,2 @@ +comments = false +analytics = false \ No newline at end of file