diff --git a/.github/workflows/neocities.yml b/.github/workflows/neocities.yml new file mode 100644 index 0000000..f40c284 --- /dev/null +++ b/.github/workflows/neocities.yml @@ -0,0 +1,31 @@ +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 diff --git a/README.md b/README.md index 2f20ac7..e70b2e3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # deploy-to-neocities +[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/bcomnes/deploy-to-neocities)](https://github.com/bcomnes/deploy-to-neocities) [![Actions Status](https://github.com/bcomnes/deploy-to-neocities/workflows/tests/badge.svg)](https://github.com/bcomnes/deploy-to-neocities/actions) +[![Marketplace link](https://img.shields.io/badge/github%20marketplace-deploy--to--neocities-brightgreen)](https://github.com/marketplace/actions/deploy-to-neocities)
@@ -42,6 +44,9 @@ jobs: dist_dir: public ``` +- 💻 [Example YML](.github/workflows/neocities.yml) +- 🌎 [Example Deploy](https://deploy-to-neocities.neocities.org) + Create a workflow `.yml` file in your repositories `.github/workflows` directory. An [example workflow](#example-workflow) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file). Get your sites API token and set a [secret][sec] called `NEOCITIES_API_TOKEN`. Set the `api_token` input on your `deploy-to-neocities` action to `NEOCITIES_API_TOKEN`. @@ -54,7 +59,7 @@ During your workflow, generate the files you want to deploy to [Neocities][nc] i 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. +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 diff --git a/example.yml b/example.yml deleted file mode 100644 index 34dce59..0000000 --- a/example.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Example usage - -on: [push] - -jobs: - example: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - node: [12] - - steps: - - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node }} - - name: npm install and build - run: | - npm i - npm run build - env: - CI: true - - name: Deploy to neocities - uses: bcomnes/deploy-to-neocities@master - with: - api-token: ${{ secrets.NEOCITIES_API_TOKEN }} - distDir: public - cleanup: true diff --git a/layout.html b/layout.html new file mode 100644 index 0000000..3661509 --- /dev/null +++ b/layout.html @@ -0,0 +1,15 @@ + + + + + Deploy to Neocities + + + + + + + +
+ + diff --git a/package.json b/package.json index 1ad1180..bfa605c 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,15 @@ "version:1-changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING:' && git add CHANGELOG.md", "version:2-cleandeps": "mv node_modules tmp_modules && npm i --only=prod && git add node_modules --force", "postversion": "rm -rf node_modules && mv tmp_modules node_modules", - "clean": "rimraf dist && mkdirp dist", - "build": "mkdir public && cp package.json public/test.json" + "clean": "rimraf public && mkdirp public", + "build": "npm run clean && run-p build:*", + "build:md": "sitedown . -b public -l layout.html", + "build:static": "cpx 'static/*' public", + "start": "npm run watch", + "watch": "npm run clean && run-p watch:*", + "watch:js": "budo --dir public --live --open", + "watch:md": "npm run build:md -- -w", + "watch:static": "npm run build:static -- --watch" }, "repository": { "type": "git", @@ -29,6 +36,8 @@ "homepage": "https://github.com/bcomnes/deploy-to-neocities#readme", "devDependencies": { "auto-changelog": "^1.16.2", + "budo": "^11.6.3", + "cpx2": "^2.0.0", "dependency-check": "^4.1.0", "gh-release": "^3.5.0", "npm-run-all": "^4.1.5", @@ -38,11 +47,7 @@ "@actions/core": "1.2.2", "async-neocities": "1.1.6", "ms": "^2.1.2", - "nanoassert": "^2.0.0" - }, - "standard": { - "ignore": [ - "dist" - ] + "nanoassert": "^2.0.0", + "sitedown": "^4.0.0" } } diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..2120c91 Binary files /dev/null and b/static/favicon.ico differ diff --git a/logo.png b/static/logo.png similarity index 100% rename from logo.png rename to static/logo.png