Use Nix flake for building the site (#2) #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to neocities | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
concurrency: # prevent concurrent deploys doing strange things | |
group: deploy-to-neocities | |
cancel-in-progress: true | |
jobs: | |
# https://gist.github.com/AndrewLester/2d3e6257d932831756226ca9a281d9b5 | |
build_site: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
submodules: true | |
- name: Git Submodule Update | |
run: | | |
git pull --recurse-submodules | |
git submodule update --remote --recursive | |
- name: Install Nix | |
uses: cachix/install-nix-action@v31 | |
# If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` | |
# - name: Install pnpm | |
# uses: pnpm/action-setup@v3 | |
# with: | |
# version: 8 | |
- name: build | |
uses: cachix/install-nix-action@v31 | |
env: | |
BASE_PATH: '/${{ github.event.repository.name }}' | |
run: | | |
nix build | |
mkdir -p public/ | |
cp -r result/* public/ | |
- name: Deploy to neocities | |
if: ${{ success() || failure() }} | |
uses: bcomnes/deploy-to-neocities@v1.1.9 | |
with: | |
api_token: ${{ secrets.NEOCITIES_API_TOKEN }} | |
cleanup: false | |
dist_dir: result |