Configure Github Actions for bulid
- Let start by setting up
Node.js
workflow. -
Go to
Actions
tab in your project and findNode.js
workflow.
(it may be hidden under
More continuous integration workflows...
)
and pressSet up this workflow
button. Rename
node.js.yml
tobuild.yml
. Commitbuild.yml
withStart commit
button. AddCreate .github/workflows/build.yml
commit message.
On commit pre-commit.ci
may fail because of prettier
formatting.
git pull
pre-commit run --all-files
git add -u
git commit -m 'fix: prettier formating'
Update .github/workflows/build.yml
-
We do not have tests yet and
build
is present inpackage.json
- run: npm ci - - run: npm run build --if-present - - run: npm test + - run: npm run build
git add -u
git commit -m 'do not run npm test for build workflow'
Add badge
-
Add
![build](https://github.com/<OWNER>/<REPOSITORY>/actions/workflows/build.yml/badge.svg)
to README.md. From docsYou reference the workflow by the name of your workflow file.
![example workflow](https://github.com/<OWNER>/<REPOSITORY>/actions/workflows/<WORKFLOW_FILE>/badge.svg)
git add -u
git commit -m 'add build workflow badge'
Links
- https://docs.github.com/en/actions
- https://docs.github.com/en/actions/guides/setting-up-continuous-integration-using-workflow-templates
- https://github.com/actions/setup-node
- https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml
Top comments (0)