Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release automation #95

Merged
merged 70 commits into from
Mar 24, 2021
Merged

Conversation

petr-pokorny-1
Copy link
Contributor

@petr-pokorny-1 petr-pokorny-1 commented Mar 11, 2021

GitHub workflow for releasing new versions

The logic is split in two jobs

  • First jobs perform tests. It runs on Windows runner since Linux runners don't have GPU, which is required by many tests.
  • Second job runs on Linux and creates builds minified library, creates github release, uploads release assets, updates version in npm package and submits package in the npm registry.

Workflow Description

The workflow is triggered when a tag is pushed or It can also be triggered manually.
After the workflow starts it searches for the most recent version tag (that is a tag with v*.*.* format) and uses the version from this tag for the next processing. The version must follow semantic versioning rules.

There can be regular version (i.e. 1.13.0) or pre-release (i.e. 1.13.0-rc.1).

In case of regular version the action parses CHANGELOG.md and creates release notes based on current and last version. Release notes are not generated for pre-release versions. In case of pre-release versions the github release is marked as pre-release accordingly.

The changelog should be updated on every PR - there is a placeholder at the top of the document - and heading should be renamed to the same version which is going to be set in the version tag during release.

Workflow Setup

The workflow expects there is NODE_AUTH_TOKEN secret in the repo settings which is used for pushing to npm registry.

There are no tags in the maplibre-gl-js repo currently. Initial tags can be setup as follows:

git tag -a v1.13.0 f87090b -m "version 1.13.0"                                                
git tag -a v1.13.1 -m "version 1.13.1"                                                        
git push --tags 

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2021

Bundle size report:

Size Change: 0 B
Total Size Before: 201 kB
Total Size After: 201 kB

Output file Before After Change
maplibre-gl.js 196 kB 196 kB 0 B
maplibre-gl.css 4.62 kB 4.62 kB 0 B
ℹ️ View Details No major changes

@nyurik
Copy link
Member

nyurik commented Mar 11, 2021

looks awesome, thanks! A few minor things:

  • there is a number of linting issues, as shown in the files changed tab
  • I think we should validate the tag for consistency, e.g. verify that it starts with a v, and that the number is valid, and that the changelog has a section dedicated to that version (the changelog would have the same version but without v?). The changelog requirement might be different for beta/rc releases (TBD).

package.json Outdated Show resolved Hide resolved
test/ignores.json Outdated Show resolved Hide resolved
build/version-utils.js Show resolved Hide resolved
build/version-utils.js Outdated Show resolved Hide resolved
build/version-utils.js Outdated Show resolved Hide resolved
build/version-utils.js Outdated Show resolved Hide resolved
petr-pokorny-1 and others added 4 commits March 12, 2021 08:01
@petr-pokorny-1
Copy link
Contributor Author

I think we should validate the tag for consistency, e.g. verify that it starts with a v, and that the number is valid

This should be addressed here

case 'validate-latest-tag':

The tag format should be ensured by regular expressions. One more validation there checks if the new version tag is greater than the previous one (using semver library)

and that the changelog has a section dedicated to that version (the changelog would have the same version but without v?).

The test is here:

if (!currentReleaseNotes) {

The explanation how the relevant parts of changelog is matched is here:

(this is original code from Mapbox)

The changelog requirement might be different for beta/rc releases (TBD).

The workflow has one variant for beta/rc releases and second for regular releases. For beta/rc releases, no release notes are produced. I would suggest to come up with solution for beta release notes in another PR if they are needed.

Copy link
Member

@nyurik nyurik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more minor suggestions - I think it is better to rely on semver library for all parsing/testing, than to use regex - except to test that the semver begins with a v -- because semver automatically removes it. tags.map(v => v.trim()).filter(v => /^v\d/.test(v)).map(v => semver.validate(v)).filter(v => v) should work (or something similar).

Agree with your point about beta/release notes.

build/version-utils.js Outdated Show resolved Hide resolved
build/version-utils.js Outdated Show resolved Hide resolved
@klokan
Copy link
Member

klokan commented Mar 24, 2021

NODE_AUTH_TOKEN token is configured now.

@petr-pokorny-1 petr-pokorny-1 merged commit 12915e3 into maplibre:main Mar 24, 2021
@petr-pokorny-1 petr-pokorny-1 added this to the 1.14.0 milestone Mar 24, 2021
@klokan
Copy link
Member

klokan commented Mar 24, 2021

Please no beta / rc and other pre-releases. Just semver - and increments - as soon as the release process is fixed.

@nyurik
Copy link
Member

nyurik commented Mar 24, 2021

@klokan any reason not to automate publishing to NPM for rc/beta versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants