action-setup/src/index.ts

23 lines
614 B
TypeScript
Raw Normal View History

2020-05-09 22:02:32 +08:00
import { setFailed, saveState, getState } from '@actions/core'
2020-05-08 14:06:16 +08:00
import getInputs from './inputs'
2020-05-09 21:03:45 +08:00
import installPnpm from './install-pnpm'
2022-02-23 11:07:15 +08:00
import setOutputs from './outputs'
2020-05-09 21:24:52 +08:00
import pnpmInstall from './pnpm-install'
2020-05-09 22:15:50 +08:00
import pruneStore from './pnpm-store-prune'
2020-05-08 14:06:16 +08:00
2020-05-08 15:12:16 +08:00
async function main() {
2020-05-09 22:15:50 +08:00
const inputs = getInputs()
2020-05-09 22:02:32 +08:00
const isPost = getState('is_post')
2020-05-09 22:15:50 +08:00
if (isPost === 'true') return pruneStore(inputs)
2020-05-09 22:02:32 +08:00
saveState('is_post', 'true')
2020-05-09 21:03:45 +08:00
await installPnpm(inputs)
2020-05-08 22:55:03 +08:00
console.log('Installation Completed!')
setOutputs(inputs)
2020-05-09 21:24:52 +08:00
pnpmInstall(inputs)
2020-05-08 15:12:16 +08:00
}
2020-05-08 14:06:16 +08:00
2020-05-08 15:12:16 +08:00
main().catch(error => {
2020-05-08 14:06:16 +08:00
console.error(error)
setFailed(error)
})