deploy-to-neocities

GitHub tag (latest SemVer) Actions Status Deploy to neocities Marketplace link

Efficiently deploy a website to Neocities using Github actions. Uses content aware diffing to only update files that changed.

Usage

name: Deploy to neocities

# only run on changes to master
on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    # Set up any tools and build steps here
    # This example uses a Node.js toolchain to build a site
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: 12
    - name: Install deps and build
      run: |
        npm i
        npm run build
    # When the dist_dir is ready, deploy it to neocities
    - name: Deploy to neocities
      uses: bcomnes/deploy-to-neocities@v1
      with:
        api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
        cleanup: false
        dist_dir: public

Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Get your sites API token and set a secret called NEOCITIES_API_TOKEN. Set the api_token input on your deploy-to-neocities action to NEOCITIES_API_TOKEN.

https://neocities.org/settings/{{sitename}}#api_key

During your workflow, generate the files you want to deploy to Neocities into a dist_dir directory. You can use any tools that can be installed or brought into the Github actions environment.

Once the build is complete, deploy-to-neocities will efficiently upload all new and all changed files to Neocities. Any files on Neocities that don’t exist in the dist_dir are considered ‘orphaned’ files. To destructively remove these ‘orphaned’ files, set the cleanup input to true.

You most likely only want to run this on the master branch so that only changes committed to master result in website updates. Running a test build that does not deploy on all branches and PRs can help catch changes that will break the build.

Inputs

Outputs

None.

FAQ

Why should I deploy to Neocities?

Neocities offers a bunch of nice properties:

What are some of the drawbacks compared to Netlify/Zeit?

Sites using deploy-to-neocities

See also