- We follow the semver versioning pattern, which means we follow this versioning pattern:
MAJOR:MINOR:PATCH
.
- Git, node.js and NPM installed on your system
- You are able to build the library and have push access to the remote repository
- Secret
NPM_TOKEN
value is set on the remote repository - Secret
ACCESS_TOKEN
value is set on the remote repository
For the release steps to run fully, two repository secrets must be set as below.
NPM_TOKEN
can be created by following the steps here to create a read and publish token. The user the token belongs to must have publish access to the project on NPM.ACCESS_TOKEN
is a personal access token for a user that has access top5.js
,p5.js-website
, andp5.js-release
repositories. The token can be generated using the steps here and for scopes, choose onlyrepo
andworkflow
. It is recommended to use an organization specific account for this (ie. not from a personal account) and limit the account's write access to only the required repositories.
$ git checkout main
$ npm version [major|minor|patch] # Choose the appropriate version tag
$ git push origin main
$ git push origin v1.4.2 # Replace the version number with the one just created above
The actual release steps are all run on GitHub Actions CI.
Once the above commands have been executed, the build and release action can be monitored from the "Actions" tab on the p5.js GitHub repo page (look for a job that says "New p5.js release"), clicking into the job can give a more detailed job log of what's running.
Once the job has completed, the library will have been released on GitHub and NPM. Check the release and NPM pages to see that the latest version is released. You should view the draft release on GitHub, make changes to changelog if necessary, then publish the release.
The website will be updated as soon as its own build and deploy job is completed, this can also be monitored in the relevant "Actions" page if desired, and after that check the "Downloads" page on the website for the latest version number.
CDNs will take a bit more time (a day or two) to update but they will automatically pull from NPM upon release so no specific action is required.
The GitHub Action "New p5.js release" is triggered on a tag that matches the pattern v*.*.*
which is created by the npm version ___
command.
Once triggered, it will run the following steps:
- Clone the repository, setup node.js, extract version number, install dependencies with
npm
, and run test withnpm test
. - Create the release files that will be uploaded to GitHub releases.
- Create a release on GitHub and publish latest version on NPM.
- Update website files
- Clone the website repository
- Copy
data.json
anddata.min.json
to the right location - Copy
p5.min.js
andp5.sound.min.js
to the right location - Update
data.yml
file with latest version number - Update
en.json
file based ondata.min.json
- Commit and push the changes back to the website repository
- Update Bower files
- Clone the Bower release repository
- Copy all libraries files to the right location
- Commit and push the changes back to the website repository
In principle, we try to concentrate as many steps as possible to be run in one place, ie. in the CI environment. If a new step that is only run on release is required, it should probably be defined in the CI workflow and not as part of the build configuration.
As the release steps are run in CI, testing them can be difficult. Using act to test running of the steps locally is possible (and was how they were tested while being developed) but require some temporary modifications to the workflow definition, we'll roughly document here as the precise steps will likely change over time.
The test steps will not run because not all system requirements are present to run the mocha Chrome tests. Some system dependencies will likely be needed to be installed with apt
before setting up the rest of the environment. Keep an eye on the error messages which should give some information on what packages are missing.
The steps concerning pushing changes to remote repositories should be commented out to avoid accidentally pushing unintended changes.