ci: compile for distribution, remove node_modules #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dist/index.js
, as recommended in:https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#commit-tag-and-push-your-action-to-github
node_modules
from repo (48M)dist/index.js
as a singlle file replacement (656K)action.yml
atdist/index.js
workflows/test.yml
to ensuredist/index.js
is updated.express
andmocha
dependenciesThis PR removes the unnecessary
node_modules
dir from the repository, instead providing an npm script to build a single .js file for distribution, as recommended for GitHub .js actions.Changes after this will will need to be built (
npm run build
), and the generated files (in dist) added to the commit. This is so it can be used by other GitHub projects.I added a test job to verify that the dist files are built and committed with each change - this just builds the PR, and ensures the results are the same as in the commit. It would be good to require the build status check to pass before merging (see GitHub Docs about status checks). This will avoid confusion between a forgetting to build and commit the distribution, and the test cucumber-report checks that intentionally "fail".
.
Note that updating dependencies (and sometimes just running
npm install
locally) will updatepackage-lock.json
which also needs to be committed - this ensures the CI build uses the same dependency versions as were used to build the committed distribution locally.Of the workflow jobs, only the test job installs node modules, to use cucumber. All tests still use
dist/index.js
to run tests, and thedirect-from-repository-test
job ensures the action works as is, without having to install node modules.