First, you'll need to have a reasonably modern version of
node
handy. This won't work with versions older than 9, for instance.
Install the dependencies
yarn
Build the typescript and package it for distribution
yarn build && yarn package
Run the tests ✔️
yarn test
PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
...
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.
We use a different build to also publish the action as a standalone docker image.
Just run yarn increment <patch|minor|major>
and push the changes to main
branch. This will automatically generate a build file push to distribution branch (releases/vx
). That will in turn trigger a workflow to build Dockerfile and publish it.
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:
milliseconds: 1000
See the actions tab for runs of this action! 🚀