Compare commits

...

14 Commits

Author SHA1 Message Date
Bret Comnes
c51b62c31b 1.1.0 2021-01-17 14:16:14 -07:00
Bret Comnes
7c7e9080c0 fix site static glob 2021-01-17 14:14:08 -07:00
Bret Comnes
b2793d2827 clean up 2021-01-17 14:08:36 -07:00
Bret Comnes
cadbbff700 Add a protected_files input that accepts a minimatch glob 2021-01-17 14:05:12 -07:00
Bret Comnes
15d3299d41 1.0.17 2021-01-17 11:15:40 -07:00
Bret Comnes
64c177bb7c Use standard breaking change identifier 2021-01-17 11:15:32 -07:00
Bret
b0315b3ae6 Merge pull request #30 from bcomnes/fix-large-deploys
Fix problems with large deploys by updating to async-neocities 2.0.0
2021-01-17 11:13:07 -07:00
Bret Comnes
c1d930633a Fix problems with large deploys by updating to async-neocities 2.0.0 2021-01-17 11:11:11 -07:00
Bret
606f4dafbe Merge pull request #29 from victoriadrake/patch-2
Adding Neofeed!
2021-01-12 20:27:37 -07:00
Victoria Drake
96bb73cc55 Adding Neofeed!
Adding a link to my project that uses this action, as requested!
2021-01-12 18:57:33 -05:00
bcomnes
fcce66f4d9 1.0.16 2021-01-04 16:00:20 +00:00
Bret
eb27830b09 Merge pull request #27 from bcomnes/dependabot/npm_and_yarn/ms-2.1.3
chore(deps): bump ms from 2.1.2 to 2.1.3
2021-01-04 08:59:29 -07:00
dependabot[bot]
eedc025255 chore(deps): bump ms from 2.1.2 to 2.1.3
Bumps [ms](https://github.com/vercel/ms) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/vercel/ms/releases)
- [Commits](https://github.com/vercel/ms/compare/2.1.2...2.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 07:37:12 +00:00
Bret
362544ea65 Update README.md 2021-01-03 15:54:56 -07:00
10 changed files with 2252 additions and 1224 deletions

View File

@@ -17,15 +17,14 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v2.1.4
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/*'

View File

@@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [12]
node: [15]
steps:
- uses: actions/checkout@v2
@@ -17,10 +17,8 @@ jobs:
uses: actions/setup-node@v2.1.4
with:
node-version: ${{ matrix.node }}
- name: npm install && npm test
run: |
npm i
npm test
- run: npm i
- run: npm test
automerge:
needs: test

17
.vscode/launch.json vendored
View File

@@ -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"
}
]
}

View File

@@ -7,7 +7,36 @@ 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.15](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.14...v1.0.15)
## [v1.1.0](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.17...v1.1.0)
### 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
- chore(deps): bump ms from 2.1.2 to 2.1.3 [`#27`](https://github.com/bcomnes/deploy-to-neocities/pull/27)
### Commits
- Update README.md [`362544e`](https://github.com/bcomnes/deploy-to-neocities/commit/362544ea6507553a7155f083e222c502f1863663)
## [v1.0.15](https://github.com/bcomnes/deploy-to-neocities/compare/v1.0.14...v1.0.15) - 2021-01-03
### Merged

View File

@@ -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
@@ -113,6 +114,7 @@ None.
- 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.
- ...PR your site when you set it up!
## See also
@@ -122,6 +124,10 @@ None.
- [neocities/neocities-node](https://github.com/neocities/neocities-node): Official Node API
- [jonchang/deploy-neocities](https://github.com/jonchang/deploy-neocities): An alternative docker + official ruby client based action similar to this one.
## CHANGELOG
See [changelog.md](CHANGELOG.md)
[qs]: https://ghub.io/qs
[nf]: https://ghub.io/node-fetch
[fd]: https://ghub.io/form-data

View File

@@ -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'

3369
dist/index.js vendored

File diff suppressed because it is too large Load Diff

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -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 => {

View File

@@ -1,15 +1,16 @@
{
"name": "deploy-to-neocities",
"description": "Github Action to deplpoy a folder to Neocities.org",
"version": "1.0.15",
"version": "1.1.0",
"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",
"ms": "2.1.2",
"async-neocities": "2.1.1",
"minimatch": "^3.0.4",
"ms": "2.1.3",
"webassert": "3.0.2"
},
"devDependencies": {
@@ -18,7 +19,7 @@
"budo": "^11.6.3",
"cpx2": "^3.0.0",
"dependency-check": "^4.1.0",
"gh-release": "^4.0.0",
"gh-release": "^5.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",