- Notifications
You must be signed in to change notification settings - Fork0
Create a TypeScript Action with tests, linting, workflow, publishing, and versioning
License
DinnerMonster/typescript-action
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Use this template to bootstrap the creation of a TypeScript action.:rocket:
This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.
If you are new, there's also a simpler introduction. See theHello World JavaScript Action
Click theUse this Template and provide the new repo details for your action
First, you'll need to have a reasonably modern version of
nodehandy. This won't work with versions older than 9, for instance.
Install the dependencies
$ npm install
Build the typescript and package it for distribution
$ npm run build&& npm run packageRun the tests ✔️
$ npmtest PASS ./index.test.js ✓ throws invalid number (3ms) ✓wait 500 ms (504ms) ✓test runs (95ms)...
The action.yml defines the inputs and output for your action.
Update the action.yml with your name, description, inputs and outputs for your action.
See thedocumentation
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
import*ascorefrom'@actions/core';...asyncfunctionrun(){try{ ...}catch(error){core.setFailed(error.message);}}run()
See thetoolkit documentation for the various packages.
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then runncc and push the results:
$ npm run package$ git add dist$ git commit -a -m"prod dependencies"$ git push origin releases/v1Note: We recommend using the--license option for ncc, which will create a license file for all of the production node modules used in your project.
Your action is now published! 🚀
See theversioning documentation
You can now validate the action by referencing./ in a workflow in your repo (seetest.yml)
uses:./with:milliseconds:1000
See theactions tab for runs of this action! 🚀
After testing you cancreate a v1 tag to reference the stable and latest V1 action
About
Create a TypeScript Action with tests, linting, workflow, publishing, and versioning
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- TypeScript90.9%
- JavaScript9.1%