Skip to content

Commit

Permalink
Update to the latest async-neocities 4.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE: api_token action input is renamed to api_key, please update this

BREAKING CHANGE: added a required neocities_supporter action input to toggle unsupported file filtering

BREAKING CHANGE: addad a preview_before_deploy action input to toggle informational deploy plans prior to deploys

BREAKING CHANGE: completely rewrote the underlying library to provide better error handling and reporting

BREAKING CHANGE: Remove a bunch of real time stats and progress meters. Deploys were finishing in seconds and these were very complicated to maintain.
  • Loading branch information
bcomnes committed Nov 20, 2024
1 parent f9a550f commit 7b14798
Show file tree
Hide file tree
Showing 13 changed files with 28,750 additions and 10,758 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/neocities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- master

env:
FORCE_COLOR: 1
node_version: lts/*
Expand All @@ -32,7 +32,9 @@ jobs:
- name: Deploy to neocities
uses: bcomnes/deploy-to-neocities@master # dont use master in production
with:
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
api_key: ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup: true
dist_dir: public
protected_files: 'dropbox/*'
neocities_supporter: true # set this to true if you have a supporter account and want to bypass unsuported files filter.
preview_before_deploy: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ public
node_modules
tmp_modules
package-lock.json
coverage
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

Efficiently deploy a website to [Neocities][nc] using [Github actions](https://github.com/features/actions). Uses content aware diffing to only update files that changed.

Alternatively, you can use the bin helper in [async-neocities](https://github.com/bcomnes/async-neocities) to deploy to neocities locally from your own machine as well as in CI.

## Usage

```yaml
Expand All @@ -30,23 +32,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# 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@v3
uses: actions/setup-node@v4
with:
node-version: lts/*
# If you have a different build process, replace this with your own build steps
- 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@v2
uses: bcomnes/deploy-to-neocities@v3
with:
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
api_key: ${{ secrets.NEOCITIES_API_TOKEN }}
cleanup: false
neocities_supporter: false # set this to true if you have a supporter account and want to bypass unsuported files filter.
preview_before_deploy: true # print a deployment plan prior to waiting for files to upload.
dist_dir: public
```
Expand All @@ -73,7 +78,9 @@ You most likely only want to run this on the `master` branch so that only change

- `api_token` (**REQUIRED**): The API token for your [Neocities][nc] website to deploy to.
- `dist_dir`: The directory to deploy to [Neocities][nc]. Default: `public`. Don't deploy your root repo directory (e.g. `./`). It contains `.git`, `.github` and other files that won't deploy properly to neocities. Keep it clean by keeping or building your site into a subdir and deploy that.
- `neocoties_supporter`: Set this to `true` if you have a paid neocities account and want to bypass the [unsupported files filter](https://neocities.org/site_files/allowed_types).
- `cleanup`: Boolean string (`true` or `false`). If `true`, `deploy-to-neocities` will destructively delete files found on [Neocities][nc] not found in your `dist_dir`. Default: `false`.
- `preview_before_deploy`: Boolean string (`true` or `false`). If `true`, `deploy-to-neocities` will print a preview of the files that will be uploaded and deleted. Default: `true`.
- `protected_files`: An optional glob string used to mark files as protected. Protected files are never cleaned up. Test this option out with `cleanup` set to false before relying on it. Protected files are printed when `cleanup` is set to true or false. Glob strings are processed by [minimatch](https://github.com/isaacs/minimatch) against remote neocities file paths. Protected files can still be updated.

### Outputs
Expand Down
20 changes: 16 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@ branding:
icon: aperture
color: orange
inputs:
api_token: # api token for site to deploy to
description: 'Neocities API token for site to deploy to'
api_key: # api token for site to deploy to
description: 'Neocities API key for site to deploy to'
required: true
dist_dir:
description: 'Local folder to deploy to neocities'
default: 'public'
required: true
neocities_supporter:
description: 'Set to true if you are a Neocities supporter to bypass file type upload restrictions'
default: 'false'
required: true
cleanup:
description: Delete orphaned files on neocities that don't exist in distDir
default: false
default: 'false'
required: true
preview_before_deploy:
description: 'Set to true if you want to print deploy preview stats prior to deploying.'
default: 'true'
required: false
protected_files:
description: A glob string that prevents matched files from ever being deleted.
required: false
api_token: # api token for site to deploy to
description: 'Neocities API key for site to deploy to'
required: false
deprecationMessage: 'api_token is deprecated, use api_key instead'
runs:
using: 'node20'
main: 'dist/index.js'
main: 'dist/index.cjs'
Loading

0 comments on commit 7b14798

Please sign in to comment.