-
-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v1.13.0-rc.6 * MapLibre 1.13.1 baseline - ignoring failed tests * Initial version of release workflow * Release workflow tests * Testing release workflow * Package updates * lint issues * Testing release build * Excluding tests which wont run on GH runner without GPU * Lint issue * Testing release script * Testing release script * testing release script * Cleanup * Fixes * Added missing command * Fixes * Fixes * Fix for windows runner * Another attempt * Another attempt * Another attempt * Another attempt * Tests * Test * Another attempt * Another attempt * Another attempt * Testing on self-hosted runner * Fixes for windows runner * Back to default runner * Fixes * v1.13.1 * Fixes * Fixes * Fixes * testing release * Fixes * testing release script * Testing release script * Version Bump * teting build * Testing build * Version Bump * Testing build * Version Bump * Testing build * Version Bump * Another test * Version Bump * Making tarball check non-interactive * another test & trabal check fix * Version Bump * Removing debug code & clean up * Removing vscode stuff * Remove formatting changes * Added missing packages * Revert formating changes * lint issues * Update package.json Co-authored-by: Yuri Astrakhan <[email protected]> * Update build/version-utils.js Co-authored-by: Yuri Astrakhan <[email protected]> * Update test/ignores.json Co-authored-by: Yuri Astrakhan <[email protected]> * PR review fixes * Addressing PR review * Changelog update for v1.14.0 Co-authored-by: MapLibre <[email protected]> Co-authored-by: Yuri Astrakhan <[email protected]>
- Loading branch information
1 parent
256d1b8
commit 12915e3
Showing
9 changed files
with
392 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# To trigger the workflow, tag sources and push | ||
# git tag -a v1.13.1 -m "version 1.13.1" | ||
# to tag old revision: | ||
# git tag -a v1.13.0-beta.1 2112766 -m "version 1.13.0-beta.1" | ||
# git tag -a v1.13.0 f87090b -m "version 1.13.0" | ||
# git push --tags | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- v* | ||
paths-ignore: | ||
- ".github/**" | ||
- "**/*.md" | ||
|
||
jobs: | ||
lint_build_test: | ||
name: Build, Lint and Test | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 10 x64 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 10 | ||
architecture: x64 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Validate version tag | ||
run: | | ||
node build\version-utils.js validate-latest-tag | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
$LatestVersionTag=$(node build\version-utils.js latest-version-tag) | ||
echo "Latest version tag=$LatestVersionTag" | ||
echo "::set-output name=version_tag::$LatestVersionTag" | ||
- name: Ensure correct revision | ||
run: | | ||
git checkout tags/${{ steps.prepare.outputs.version_tag }} | ||
- name: Lint | ||
run: | | ||
yarn run lint | ||
yarn run lint-docs | ||
yarn run lint-css | ||
- name: Test | ||
run: | | ||
yarn run test-flow | ||
yarn run test-unit | ||
yarn run test-render | ||
yarn run test-query | ||
yarn run test-expressions | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: lint_build_test | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use Node.js 10 x64 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 10 | ||
architecture: x64 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Validate version tag | ||
run: | | ||
build/version-utils.js validate-latest-tag | ||
- name: Prepare release | ||
id: prepare_release | ||
run: | | ||
echo ::set-output name=version_tag::$( build/version-utils.js latest-version-tag) | ||
echo ::set-output name=version::$( build/version-utils.js version-from-tags) | ||
echo ::set-output name=release_type::$( build/version-utils.js version-type ) | ||
- name: Ensure correct revision | ||
run: | | ||
git checkout tags/${{ steps.prepare_release.outputs.version_tag }} | ||
- name: Build | ||
run: | | ||
yarn run build-prod-min | ||
yarn run build-css | ||
- name: Create Archive | ||
run: | | ||
zip -r dist dist | ||
- name: Build Release Notes | ||
id: release_notes | ||
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }} | ||
run: | | ||
RELEASE_NOTES_PATH="${PWD}/release_notes.txt" | ||
./build/release-notes.js > ${RELEASE_NOTES_PATH} | ||
echo ::set-output name=release_notes::${RELEASE_NOTES_PATH} | ||
- name: Create GitHub Release (regular) | ||
id: create_regular_release | ||
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.prepare_release.outputs.version_tag }} | ||
release_name: ${{steps.prepare_release.outputs.version_tag }} | ||
body_path: ${{ steps.release_notes.outputs.release_notes }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload GitHub Release Assets (regular) | ||
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }} | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_regular_release.outputs.upload_url }} | ||
asset_path: ./dist.zip | ||
asset_name: dist.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Create GitHub Release (prerelease) | ||
id: create_prerelease | ||
if: ${{ steps.prepare_release.outputs.release_type == 'prerelease' }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.prepare_release.outputs.version_tag }} | ||
release_name: ${{steps.prepare_release.outputs.version_tag }} | ||
draft: false | ||
prerelease: true | ||
|
||
- name: Upload GitHub Release Assets (prerelease) | ||
uses: actions/upload-release-asset@v1 | ||
if: ${{ steps.prepare_release.outputs.release_type == 'prerelease' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_prerelease.outputs.upload_url }} | ||
asset_path: ./dist.zip | ||
asset_name: dist.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Clean up | ||
if: ${{ steps.prepare_release.outputs.release_type == 'regular' }} | ||
run: | | ||
rm -f ${{ steps.prepare_release.outputs.release_notes }} | ||
- name: Update NPM Package Version | ||
run: | | ||
yarn version --non-interactive --no-git-tag-version --new-version ${{ steps.prepare_release.outputs.version }} | ||
- name: Commit & Push updated version | ||
run: | | ||
git add package.json | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "MapLibre" | ||
git commit -m "Version Bump" | ||
git push origin HEAD:main | ||
else | ||
echo "no changes"; | ||
fi | ||
- name: Publish NPM package | ||
run: | | ||
yarn publish --non-interactive | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const execSync = require('child_process').execSync; | ||
const ejs = require('ejs'); | ||
const _ = require('lodash'); | ||
const semver = require('semver'); | ||
|
||
const changelogPath = 'CHANGELOG.md'; | ||
const changelog = fs.readFileSync(changelogPath, 'utf8'); | ||
|
||
let currentVersion = execSync('git describe --tags --match=v*.*.* --abbrev=0') | ||
.toString() | ||
.trim() | ||
.replace('v', ''); | ||
|
||
let gitTags = execSync('git tag --list v*.*.*') | ||
.toString() | ||
.split('\n') | ||
.map(function(tag) { | ||
tag = tag.replace('v', '').trim(); | ||
return semver.clean(tag); | ||
}); | ||
let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion, { includePrerelease: false }); | ||
|
||
/* | ||
Parse the raw changelog text and split it into individual releases. | ||
This regular expression: | ||
- Matches lines starting with "## x.x.x". | ||
- Groups the version number. | ||
- Skips the (optional) release date. | ||
- Groups the changelog content. | ||
- Ends when another "## x.x.x" is found. | ||
*/ | ||
const regex = /^## (\d+\.\d+\.\d+).*?\n(.+?)(?=\n^## \d+\.\d+\.\d+.*?\n)/gms; | ||
|
||
let releaseNotes = []; | ||
// eslint-disable-next-line no-cond-assign | ||
while (match = regex.exec(changelog)) { | ||
releaseNotes.push({ | ||
'version': match[1], | ||
'changelog': match[2].trim(), | ||
}); | ||
} | ||
|
||
/* | ||
Match the current tag with the most appropriate release notes. | ||
*/ | ||
const versionsInReleaseNotes = _.map(releaseNotes, 'version'); | ||
const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion); | ||
const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion }); | ||
|
||
if (!currentReleaseNotes) { | ||
console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "main" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]); | ||
process.exit(1); // eslint-disable-line no-process-exit | ||
} | ||
|
||
/* | ||
Fill and print the release notes template. | ||
*/ | ||
let templatedReleaseNotes; | ||
|
||
templatedReleaseNotes = ejs.render(fs.readFileSync('build/release-notes.md.ejs', 'utf8'), { | ||
'CURRENTVERSION': currentVersion, | ||
'PREVIOUSVERSION': previousVersion, | ||
'CHANGELOG': currentReleaseNotes.changelog, | ||
'isPrerelease': semver.prerelease(currentVersion) | ||
}); | ||
templatedReleaseNotes = templatedReleaseNotes.trimEnd(); | ||
|
||
// eslint-disable-next-line eol-last | ||
process.stdout.write(templatedReleaseNotes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
https://github.com/maplibre/maplibre-gl-js | ||
[Changes](https://github.com/maplibre/maplibre-gl-js/compare/v<%-PREVIOUSVERSION%>...v<%-CURRENTVERSION%>) since [MapLibre GL JS v<%-PREVIOUSVERSION%>](https://github.com/maplibre/releases/tag/v<%-PREVIOUSVERSION%>): | ||
|
||
<%-CHANGELOG-%> | ||
|
||
<% if (isPrerelease) { %> | ||
Pre-release version | ||
<% } -%> |
Oops, something went wrong.