mirror of
https://github.com/bcomnes/deploy-to-neocities.git
synced 2026-01-21 08:51:54 +00:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44798856b1 | ||
|
|
e5cdffd285 | ||
|
|
2e14724f72 | ||
|
|
269cea9a85 | ||
|
|
b05435526e | ||
|
|
c141314092 | ||
|
|
5376b1e544 | ||
|
|
c5b9053826 | ||
|
|
c20b64ec3a | ||
|
|
dc4d4eeff9 | ||
|
|
d2a405bb36 | ||
|
|
73581be8da | ||
|
|
3050c92cd1 | ||
|
|
14bee33aca | ||
|
|
01a9dd76fb | ||
|
|
ea2f09c886 | ||
|
|
e51d6e0f99 | ||
|
|
be68564ed0 | ||
|
|
23f364e349 | ||
|
|
33ef0e7fab | ||
|
|
94fb156784 | ||
|
|
44e467a189 | ||
|
|
17d6a4b01b | ||
|
|
f5e446cd23 | ||
|
|
d551e2e3dc | ||
|
|
1f6ee0a605 | ||
|
|
3d49a264a5 | ||
|
|
87f22c65f9 | ||
|
|
47edf7607e | ||
|
|
c51b62c31b | ||
|
|
7c7e9080c0 | ||
|
|
b2793d2827 | ||
|
|
cadbbff700 | ||
|
|
15d3299d41 | ||
|
|
64c177bb7c | ||
|
|
b0315b3ae6 | ||
|
|
c1d930633a | ||
|
|
606f4dafbe | ||
|
|
96bb73cc55 |
15
.github/workflows/neocities.yml
vendored
15
.github/workflows/neocities.yml
vendored
@@ -11,21 +11,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2.3.4
|
||||
# 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@v2.1.4
|
||||
uses: actions/setup-node@v2.4.0
|
||||
with:
|
||||
node-version: 12
|
||||
- name: Install deps and build
|
||||
run: |
|
||||
npm i
|
||||
npm run build
|
||||
node-version: 15
|
||||
- run: npm i
|
||||
- run: npm run build
|
||||
# When the dist_dir is ready, deploy it to neocities
|
||||
- name: Deploy to neocities
|
||||
uses: bcomnes/deploy-to-neocities@master # dont use master in production
|
||||
with:
|
||||
api_token: ${{ secrets.NEOCITIES_API_TOKEN }}
|
||||
cleanup: false
|
||||
cleanup: true
|
||||
dist_dir: public
|
||||
protected_files: 'dropbox/*'
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -14,11 +14,11 @@ jobs:
|
||||
version_and_release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.2
|
||||
- uses: actions/checkout@v2.3.4
|
||||
with:
|
||||
# fetch full history so things like auto-changelog work properly
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-node@v2.1.4
|
||||
- uses: actions/setup-node@v2.4.0
|
||||
with:
|
||||
node-version: ${{ env.node_version }}
|
||||
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
|
||||
|
||||
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
@@ -9,24 +9,22 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node: [12]
|
||||
node: [15]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2.1.4
|
||||
uses: actions/setup-node@v2.4.0
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: npm install && npm test
|
||||
run: |
|
||||
npm i
|
||||
npm test
|
||||
- run: npm i
|
||||
- run: npm test
|
||||
|
||||
automerge:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: fastify/github-action-merge-dependabot@v1.1.1
|
||||
- uses: fastify/github-action-merge-dependabot@v2.4.0
|
||||
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' && contains(github.head_ref, 'dependabot/github_actions') }}
|
||||
with:
|
||||
github-token: ${{secrets.github_token}}
|
||||
|
||||
17
.vscode/launch.json
vendored
17
.vscode/launch.json
vendored
@@ -1,17 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/test.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
50
CHANGELOG.md
50
CHANGELOG.md
@@ -7,7 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
## [v1.0.16](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.15...v1.0.16)
|
||||
## [v1.1.1](https://github.com/bcomnes/deploy-to-neocities/compare/v1.1.0...v1.1.1)
|
||||
|
||||
### Merged
|
||||
|
||||
- chore(deps): bump @actions/core from 1.4.0 to 1.5.0 [`#50`](https://github.com/bcomnes/deploy-to-neocities/pull/50)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#49`](https://github.com/bcomnes/deploy-to-neocities/pull/49)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#48`](https://github.com/bcomnes/deploy-to-neocities/pull/48)
|
||||
- chore(deps): bump actions/setup-node from 2.3.2 to 2.4.0 [`#47`](https://github.com/bcomnes/deploy-to-neocities/pull/47)
|
||||
- chore(deps): bump actions/setup-node from 2.3.1 to 2.3.2 [`#46`](https://github.com/bcomnes/deploy-to-neocities/pull/46)
|
||||
- chore(deps): bump actions/setup-node from 2.3.0 to 2.3.1 [`#45`](https://github.com/bcomnes/deploy-to-neocities/pull/45)
|
||||
- chore(deps): bump actions/setup-node from 2.2.0 to 2.3.0 [`#44`](https://github.com/bcomnes/deploy-to-neocities/pull/44)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#43`](https://github.com/bcomnes/deploy-to-neocities/pull/43)
|
||||
- chore(deps): bump actions/setup-node from 2.1.5 to 2.2.0 [`#42`](https://github.com/bcomnes/deploy-to-neocities/pull/42)
|
||||
- chore(deps): bump @actions/core from 1.3.0 to 1.4.0 [`#41`](https://github.com/bcomnes/deploy-to-neocities/pull/41)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#40`](https://github.com/bcomnes/deploy-to-neocities/pull/40)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#39`](https://github.com/bcomnes/deploy-to-neocities/pull/39)
|
||||
- chore(deps): bump @actions/core from 1.2.7 to 1.3.0 [`#38`](https://github.com/bcomnes/deploy-to-neocities/pull/38)
|
||||
- chore(deps-dev): bump gh-release from 5.0.2 to 6.0.0 [`#37`](https://github.com/bcomnes/deploy-to-neocities/pull/37)
|
||||
- chore(deps): bump actions/checkout from 2 to 2.3.4 [`#36`](https://github.com/bcomnes/deploy-to-neocities/pull/36)
|
||||
- chore(deps): bump @actions/core from 1.2.6 to 1.2.7 [`#35`](https://github.com/bcomnes/deploy-to-neocities/pull/35)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot from v1.2.1 to v2.0.0 [`#34`](https://github.com/bcomnes/deploy-to-neocities/pull/34)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot [`#33`](https://github.com/bcomnes/deploy-to-neocities/pull/33)
|
||||
- chore(deps): bump fastify/github-action-merge-dependabot from v1.1.1 to v1.2.0 [`#32`](https://github.com/bcomnes/deploy-to-neocities/pull/32)
|
||||
- chore(deps): bump actions/setup-node from v2.1.4 to v2.1.5 [`#31`](https://github.com/bcomnes/deploy-to-neocities/pull/31)
|
||||
|
||||
### Commits
|
||||
|
||||
- Update README.md [`c20b64e`](https://github.com/bcomnes/deploy-to-neocities/commit/c20b64ec3ad139d92da5bd9d956cd86bd3786850)
|
||||
|
||||
## [v1.1.0](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.17...v1.1.0) - 2021-01-17
|
||||
|
||||
### Commits
|
||||
|
||||
- Add a protected_files input that accepts a minimatch glob [`cadbbff`](https://github.com/bcomnes/deploy-to-neocities/commit/cadbbff70037001f49c979fa34e897efac8ab455)
|
||||
- fix site static glob [`7c7e908`](https://github.com/bcomnes/deploy-to-neocities/commit/7c7e9080c03ebfe9f1517c579e38245260ce4f0b)
|
||||
- clean up [`b2793d2`](https://github.com/bcomnes/deploy-to-neocities/commit/b2793d2827cbd21b3b2f38ac7a2da6ffafb7fcc8)
|
||||
|
||||
## [v1.0.17](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.16...v1.0.17) - 2021-01-17
|
||||
|
||||
### Merged
|
||||
|
||||
- Fix problems with large deploys by updating to async-neocities 2.0.0 [`#30`](https://github.com/bcomnes/deploy-to-neocities/pull/30)
|
||||
- Adding Neofeed! [`#29`](https://github.com/bcomnes/deploy-to-neocities/pull/29)
|
||||
|
||||
### Commits
|
||||
|
||||
- Use standard breaking change identifier [`64c177b`](https://github.com/bcomnes/deploy-to-neocities/commit/64c177bb7cb6c7cc33e53c6198218e02be928a61)
|
||||
|
||||
## [v1.0.16](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.15...v1.0.16) - 2021-01-04
|
||||
|
||||
### Merged
|
||||
|
||||
|
||||
19
README.md
19
README.md
@@ -7,7 +7,7 @@
|
||||
|
||||
<center><img src="static/logo.png"></center>
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -69,6 +69,7 @@ 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`.
|
||||
- `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`.
|
||||
- `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
|
||||
|
||||
@@ -108,11 +109,27 @@ None.
|
||||
|
||||
## Sites using deploy-to-neocities
|
||||
|
||||
(Some may be NSFW)
|
||||
|
||||
- https://github.com/bcomnes/bret.io ([bret.io](https://bret.io))
|
||||
- https://github.com/ecomnes/elenacomnes.com ([elenacomnes.comnes](https://elenacomnes.com))
|
||||
- https://github.com/gumcast/gumcast-client ([gumcast.com](https://gumcast.com))
|
||||
- https://github.com/bcomnes/deploy-to-neocities/blob/master/.github/workflows/neocities.yml ([deploy-to-neocities.neocities.org](https://deploy-to-neocities.neocities.org))
|
||||
- [Zambonifofex/stories](https://github.com/Zambonifofex/stories) ([zamstories.neocities.org](https://zamstories.neocities.org))
|
||||
- [Your Neofeed](https://github.com/victoriadrake/neocities-neofeed), (っ◔◡◔)っ a personal timeline for Neocities and GitHub Pages.
|
||||
- https://punkedwerewolf.net
|
||||
- https://speakscribe.com
|
||||
- https://geno7.neocities.org
|
||||
- https://github.com/M1ssM0ss/deploy-to-neocities-template
|
||||
- https://nelson.neocities.org
|
||||
- https://flamedfury.com
|
||||
- https://keb.neocities.org
|
||||
- https://missmoss.neocities.org
|
||||
- https://fuckingwebmaster.net
|
||||
- https://rarebit.neocities.org
|
||||
- https://cavacado.neocities.org
|
||||
- https://wanderinginn.neocities.org
|
||||
- https://andri.dk/blog/2021/deploy-static-websites-anywhere
|
||||
- ...PR your site when you set it up!
|
||||
|
||||
## See also
|
||||
|
||||
@@ -15,6 +15,9 @@ inputs:
|
||||
description: Delete orphaned files on neocities that don't exist in distDir
|
||||
default: false
|
||||
required: true
|
||||
protected_files:
|
||||
description: A glob string that prevents matched files from ever being deleted.
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
||||
3571
dist/index.js
vendored
3571
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
14
index.js
14
index.js
@@ -5,6 +5,7 @@ const path = require('path')
|
||||
const ms = require('ms')
|
||||
const assert = require('webassert').default
|
||||
const fsp = require('fs').promises
|
||||
const minimatch = require('minimatch')
|
||||
|
||||
let cleanup
|
||||
|
||||
@@ -12,6 +13,7 @@ async function doDeploy () {
|
||||
const token = core.getInput('api_token')
|
||||
const distDir = path.join(process.cwd(), core.getInput('dist_dir'))
|
||||
cleanup = JSON.parse(core.getInput('cleanup'))
|
||||
const protectedFilesGlob = core.getInput('protected_files')
|
||||
|
||||
assert(typeof cleanup === 'boolean', 'Cleanup input must be a boolean "true" or "false"')
|
||||
const stat = await fsp.stat(distDir)
|
||||
@@ -19,15 +21,23 @@ async function doDeploy () {
|
||||
|
||||
const client = new Neocities(token)
|
||||
|
||||
const stats = await client.deploy(distDir, {
|
||||
const deployOpts = {
|
||||
cleanup,
|
||||
statsCb: Neocities.statsHandler()
|
||||
})
|
||||
}
|
||||
|
||||
if (protectedFilesGlob) deployOpts.protectedFileFilter = minimatch.filter(protectedFilesGlob)
|
||||
|
||||
const stats = await client.deploy(distDir, deployOpts)
|
||||
|
||||
console.log(`Deployed to Neocities in ${ms(stats.time)}:`)
|
||||
console.log(` Uploaded ${stats.filesToUpload.length} files`)
|
||||
console.log(` ${cleanup ? 'Deleted' : 'Orphaned'} ${stats.filesToDelete.length} files`)
|
||||
console.log(` Skipped ${stats.filesSkipped.length} files`)
|
||||
console.log(` ${stats.protectedFiles.length} protected files:`)
|
||||
if (stats.protectedFiles.length) {
|
||||
console.log(stats.protectedFiles)
|
||||
}
|
||||
}
|
||||
|
||||
doDeploy().catch(err => {
|
||||
|
||||
13
package.json
13
package.json
@@ -1,14 +1,15 @@
|
||||
{
|
||||
"name": "deploy-to-neocities",
|
||||
"description": "Github Action to deplpoy a folder to Neocities.org",
|
||||
"version": "1.0.16",
|
||||
"version": "1.1.1",
|
||||
"author": "Bret Comnes <bcomnes@gmail.com> (https://bret.io/)",
|
||||
"bugs": {
|
||||
"url": "https://github.com/bcomnes/deploy-to-neocities/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "1.2.6",
|
||||
"async-neocities": "1.1.7",
|
||||
"@actions/core": "1.5.0",
|
||||
"async-neocities": "2.1.1",
|
||||
"minimatch": "^3.0.4",
|
||||
"ms": "2.1.3",
|
||||
"webassert": "3.0.2"
|
||||
},
|
||||
@@ -18,7 +19,7 @@
|
||||
"budo": "^11.6.3",
|
||||
"cpx2": "^3.0.0",
|
||||
"dependency-check": "^4.1.0",
|
||||
"gh-release": "^4.0.0",
|
||||
"gh-release": "^6.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sitedown": "^5.0.0",
|
||||
"standard": "^16.0.0"
|
||||
@@ -36,7 +37,7 @@
|
||||
"build": "npm run clean && run-p build:*",
|
||||
"build:action": "rm -rf dist && ncc build index.js -o dist -s",
|
||||
"build:md": "sitedown . -b public -l layout.html",
|
||||
"build:static": "cpx './**/*.{png,ico}' public",
|
||||
"build:static": "cpx './!(node_modules)**/*.{png,ico}' public",
|
||||
"clean": "rimraf public && mkdirp public",
|
||||
"release": "git push --follow-tags && gh-release -y",
|
||||
"start": "npm run watch",
|
||||
@@ -45,7 +46,7 @@
|
||||
"test:standard": "standard",
|
||||
"version": "run-s version:*",
|
||||
"version:build": "npm run build:action && git add dist",
|
||||
"version:changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING:' && git add CHANGELOG.md",
|
||||
"version:changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md",
|
||||
"watch": "npm run clean && run-p watch:*",
|
||||
"watch:js": "budo --dir public --live --open",
|
||||
"watch:md": "npm run build:md -- -w",
|
||||
|
||||
Reference in New Issue
Block a user