The action allows to run any npm/yarn command or a task defined in package.json. It also makes it possible to push code to GitHub for deploying.
The action will setup the following items automatically:
- Configure the git repo to enable pushing code to remote (needs a
GITHUB_TOKEN
secret) - Configure npm to allow running
npm publish
(needs aNPM_AUTH_TOKEN
secret) - Install project dependencies automatically (autodetects whether to use
yarn
ornpm
)
NPM_AUTH_TOKEN
(optional): Authentication token required fornpm publish
GITHUB_TOKEN
(optional): Authentication token required to push code to GitHub.
PACKAGE_MANAGER
(optional): The package manager to use. Supported values areyarn
andnpm
. Defaults toyarn
ifyarn.lock
is detected, otherwisenpm
is used.NPM_REGISTRY_URL
(optional): The registry for npm packages. Defaults toregistry.npmjs.org
.NPM_STRICT_SSL
(optional): Whether to use SSL for the registry. Specifyfalse
if your registry is insecure and useshttp
. Defaults totrue
.
A simple workflow which runs the deploy
script in package.json
with npm
can look like this:
workflow "Deploy" {
on = "push"
resolves = "Pages"
}
action "Master" {
uses = "actions/bin/filter@master"
args = "branch master"
}
action "Pages" {
needs = "Master"
uses = "satya164/node-app-tasks@master"
secrets = ["GITHUB_TOKEN"]
env = {
PACKAGE_MANAGER = "npm"
}
args = "run deploy"
}
You can do anything in the deploy
script, for example build code, and push to gh-pages
. e.g.:
git branch -D gh-pages
git checkout -b gh-pages && \
rm -rf dist && \
npm run build && \
git add -f dist/ && \
git commit -m 'Publish pages' && \
git push -fu origin gh-pages
git checkout @{-1}
The Dockerfile
and associated scripts and documentation in this project are released under the MIT License.
Container images built with this project include third party materials. See THIRD_PARTY_NOTICE.md for details.