diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index 6c76f8f..822d67a 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -3,27 +3,29 @@ name: Example usage on: [push] jobs: - build: - - runs-on: ubuntu-latest + example: + runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [12.x] + os: [ubuntu-latest] + node: [12] steps: - uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v1 with: - node-version: ${{ matrix.node-version }} - - run: sudo apt-get install xvfb - - name: npm install, build, and test + node-version: ${{ matrix.node }} + - name: npm install and build run: | npm i - xvfb-run --auto-servernum node example.js + npm run build env: CI: true - - name: Cleanup xvfb pidx - uses: bcomnes/cleanup-xvfb@v1 - + - name: Deploy to neocities + uses: bcomnes/deploy-to-neocities@master + with: + api-token: ${{ secrets.NeocitiesToken }} + distDir: public + cleanup: true diff --git a/action.yml b/action.yml index 3d8c520..069a69b 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,15 @@ inputs: api-token: # api token for site to deploy to description: 'Neocities API token for site to deploy to' required: true + distDir: + description: 'Local folder to deploy to neocities' + default: 'public' + required: true + cleanup: + description: Delete orphaned files on neocities that don't exist in distDir + default: false + required: true outputs: # none runs: using: 'node12' - main: 'dist/bundle.cjs.js' + main: 'index.js' diff --git a/fixtures/cat.png b/fixtures/cat.png deleted file mode 100644 index d4be8f2..0000000 Binary files a/fixtures/cat.png and /dev/null differ diff --git a/fixtures/neocities.png b/fixtures/neocities.png deleted file mode 100644 index 73e6030..0000000 Binary files a/fixtures/neocities.png and /dev/null differ diff --git a/fixtures/toot.gif b/fixtures/toot.gif deleted file mode 100755 index b75a98d..0000000 Binary files a/fixtures/toot.gif and /dev/null differ diff --git a/fixtures/tootzzz.png b/fixtures/tootzzz.png deleted file mode 100755 index 171bd72..0000000 Binary files a/fixtures/tootzzz.png and /dev/null differ diff --git a/index.js b/index.js index 918a5fc..21edd2c 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,37 @@ +const core = require('@actions/core') +// const github = require('@actions/github') +// const Neocities = require('async-neocities') +const path = require('path') +const exec = require('child_process').exec -const { NeocitiesAPIClient } = require('./lib/client.js') +async function doDeploy () { + // `who-to-greet` input defined in action metadata file + const token = core.getInput('api-token') + const distDir = core.getInput('dist-dir') + const cleanup = core.getInput('cleanup') -module.exports = { NeocitiesAPIClient } + const time = (new Date()).toTimeString() + core.setOutput('time', time) + + const client = new Neocities(token) + + console.log(process.cwd()) + console.log(path.join(process.cwd(), distDir)) + + return new Promise((resolve, reject) => { + exec('ls -la', (error, stdout, stderr) => { + console.log(stdout) + console.log(stderr) + if (error !== null) { + console.log(`exec error: ${error}`) + } + resolve() + }) + }) + + // return client.deploy() +} + +doDeploy.then(() => {}).catch(err => { + core.setFailed(err.message) +}) diff --git a/package.json b/package.json index e7ca46e..c38a361 100644 --- a/package.json +++ b/package.json @@ -23,23 +23,15 @@ }, "homepage": "https://github.com/bcomnes/deploy-to-neocities#readme", "devDependencies": { - "builtin-modules": "^3.1.0", "dependency-check": "^4.1.0", - "mkdirp": "^0.5.1", "npm-run-all": "^4.1.5", - "rimraf": "^3.0.0", "standard": "^14.3.1", "tap": "^14.10.5" }, "dependencies": { - "@actions/core": "^1.2.0", - "@actions/github": "^1.1.0", - "async-folder-walker": "^2.0.0", - "fetch-errors": "^1.0.1", - "form-data": "^3.0.0", - "nanoassert": "^2.0.0", - "pump": "^3.0.0", - "qs": "^6.9.1" + "@actions/core": "^1.2.2", + "@actions/github": "^2.1.0", + "async-neocities-tmp": "0.0.2" }, "standard": { "ignore": [