mirror of
https://github.com/webfactory/ssh-agent.git
synced 2025-06-28 21:53:46 +00:00
[FEATURE] Post step for cleaning up the SSH agent
* add `cleanup.js` for stopping the ssh-agent after the job is done * add `scripts/build.js` to make it easier to build the files in `dist/` * update README * remove meaningless dependency `child_process` (its a node core package) * update `@actions/core` to `^1.2.4`
This commit is contained in:
parent
8f59108fe4
commit
b05960c6f2
7 changed files with 387 additions and 13 deletions
35
scripts/build.js
Normal file
35
scripts/build.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const { execSync } = require('child_process')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
const buildDir = path.join(process.cwd(), 'build')
|
||||
const distDir = path.join(process.cwd(), 'dist')
|
||||
|
||||
const buildIndexJs = path.join(buildDir, 'index.js')
|
||||
const distIndexJs = path.join(distDir, 'index.js')
|
||||
const distCleanupJs = path.join(distDir, 'cleanup.js')
|
||||
|
||||
if (!fs.existsSync(buildDir)) {
|
||||
fs.mkdirSync(buildDir)
|
||||
}
|
||||
|
||||
// Build the main index.js file
|
||||
console.log('Building index.js...')
|
||||
execSync(`./node_modules/.bin/ncc build index.js -q -o ${buildDir}`)
|
||||
if (fs.existsSync(distIndexJs)) {
|
||||
fs.unlinkSync(distIndexJs)
|
||||
}
|
||||
fs.renameSync(buildIndexJs, distIndexJs)
|
||||
|
||||
// Build the cleanup.js file
|
||||
console.log('Building cleanup.js...')
|
||||
execSync(`./node_modules/.bin/ncc build cleanup.js -q -o ${buildDir}`)
|
||||
if (fs.existsSync(distCleanupJs)) {
|
||||
fs.unlinkSync(distCleanupJs)
|
||||
}
|
||||
fs.renameSync(buildIndexJs, distCleanupJs)
|
||||
|
||||
console.log('Cleaning up...')
|
||||
fs.rmdirSync(buildDir)
|
||||
|
||||
console.log('Done')
|
Loading…
Add table
Add a link
Reference in a new issue