- Node > v12.x
- npm
Install dependencies
npm install
Build typescript and package it for distribution
npm run build && npm run pack
Run tests ✔️
npm test
PASS __tests__/main.test.ts
✓ run download (1207ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 3.141s
Ran all test suites.
...
The action.yml contains defines the inputs and output for your action.
Update the action.yml with your name, description, inputs and outputs for your action.
See the documentation
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
import * as core from '@actions/core';
...
async function run() {
try {
...
}
catch (error) {
core.setFailed(error.message);
}
}
run()
See the toolkit documentation for the various packages.
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run ncc and push the results:
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
Your action is now published! 🚀
See the versioning documentation
You can now validate the action by referencing ./
in a workflow in your repo
(see test.yml)
uses: ./
with:
repository: 'user/repo'
tag: '1.0.0'
fileName: 'foo.zip'
out-file-path: '.'
See the actions tab for runs of this action! 🚀