Skip to content

Commit 6d41ea2

Browse files
authored
Update release process (#335)
1 parent f493774 commit 6d41ea2

4 files changed

Lines changed: 20 additions & 199 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -128,40 +128,3 @@ jobs:
128128
SELENIUM_BROWSER: firefox
129129
TAP_COLORS: 1
130130
run: xvfb-run -s "-ac -screen 0 1280x1024x24" npm run test-browser
131-
132-
# TODO need a data provider for these:
133-
# collect-stats:
134-
# runs-on: ubuntu-latest
135-
# needs: [build]
136-
# steps:
137-
# - uses: actions/checkout@v2
138-
# - name: Use Node.js 14 x64
139-
# uses: actions/setup-node@v2-beta
140-
# with:
141-
# node-version: 14
142-
# architecture: x64
143-
# - run: npm ci
144-
# - uses: actions/download-artifact@v2
145-
# with:
146-
# name: dist
147-
# path: ./dist
148-
# - run: find dist
149-
# - name: Collect performance stats
150-
# run: node bench/gl-stats.js
151-
# - uses: actions/upload-artifact@v2
152-
# with:
153-
# name: Performance stats
154-
# path: ./data.json.gz
155-
# test-render:
156-
# runs-on: ubuntu-latest
157-
# steps:
158-
# - name: Use Node.js 14 x64
159-
# uses: actions/setup-node@v2-beta
160-
# with:
161-
# node-version: 14
162-
# architecture: x64
163-
# - run: npm ci
164-
# - run: npm run test-render
165-
# - uses: actions/upload-artifact@v2
166-
# with:
167-
# path: test/integration/render-tests/index.html

.github/workflows/release.yml

Lines changed: 17 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,12 @@
11
name: Release
22

33
on:
4-
workflow_dispatch:
5-
push:
6-
tags:
7-
- v*
8-
paths-ignore:
9-
- ".github/**"
10-
- "**/*.md"
4+
workflow_dispatch
115

126
jobs:
13-
lint_build_test:
14-
name: Build, Lint and Test
15-
runs-on: windows-latest
16-
steps:
17-
- uses: actions/checkout@v2
18-
with:
19-
fetch-depth: 0
20-
21-
- name: Use Node.js 14 x64
22-
uses: actions/setup-node@v2
23-
with:
24-
node-version: 14
25-
architecture: x64
26-
registry-url: 'https://registry.npmjs.org'
27-
28-
- name: Install
29-
run: npm ci
30-
31-
- name: Validate version tag
32-
run: |
33-
node build\version-utils.js validate-latest-tag
34-
35-
- name: Prepare
36-
id: prepare
37-
run: |
38-
$LatestVersionTag=$(node build\version-utils.js latest-version-tag)
39-
echo "Latest version tag=$LatestVersionTag"
40-
echo "::set-output name=version_tag::$LatestVersionTag"
41-
42-
- name: Ensure correct revision
43-
run: |
44-
git checkout tags/${{ steps.prepare.outputs.version_tag }}
45-
46-
- name: Lint
47-
run: |
48-
npm run lint
49-
npm run lint-docs
50-
npm run lint-css
51-
52-
- name: Test
53-
run: |
54-
npm run test-unit
55-
npm run test-render
56-
npm run test-query
57-
npm run test-expressions
58-
597
release:
608
name: Release
619
runs-on: ubuntu-latest
62-
needs: lint_build_test
6310
defaults:
6411
run:
6512
shell: bash
@@ -68,6 +15,7 @@ jobs:
6815
- uses: actions/checkout@v2
6916
with:
7017
fetch-depth: 0
18+
ref: main
7119

7220
- name: Use Node.js 14 x64
7321
uses: actions/setup-node@v2
@@ -76,23 +24,27 @@ jobs:
7624
architecture: x64
7725
registry-url: 'https://registry.npmjs.org'
7826

27+
- name: Get version
28+
id: package-version
29+
uses: martinbeentjes/npm-get-version-action@v1.1.0
30+
31+
- name: Check tag does not exist yet
32+
run: if git rev-list v${{ steps.package-version.outputs.current-version }}; then echo "Tag already exists. Aborting the release process."; exit 1; fi
33+
34+
- name: Tag commit and push
35+
uses: mathieudutour/github-tag-action@v5.6
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
custom_tag: ${{ steps.package-version.outputs.current-version }}
39+
7940
- name: Install
8041
run: npm ci
8142

82-
- name: Validate version tag
83-
run: |
84-
build/version-utils.js validate-latest-tag
85-
8643
- name: Prepare release
8744
id: prepare_release
8845
run: |
89-
echo ::set-output name=version_tag::$( build/version-utils.js latest-version-tag)
90-
echo ::set-output name=version::$( build/version-utils.js version-from-tags)
91-
echo ::set-output name=release_type::$( build/version-utils.js version-type )
92-
93-
- name: Ensure correct revision
94-
run: |
95-
git checkout tags/${{ steps.prepare_release.outputs.version_tag }}
46+
echo ::set-output name=version_tag::v${{ steps.package-version.outputs.current-version }}
47+
echo ::set-output name=release_type::$(node -e "console.log(require('semver').prerelease('${{ steps.package-version.outputs.current-version }}') ? 'prerelease' : 'regular')")
9648
9749
- name: Build
9850
run: |

build/version-utils.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

docs/RELEASE-PROCESS.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
## Publish to NPM
22

3-
To publish this library to NPM, create a tag and push it to GitHub. Make sure that the version in ```package.json``` matches the version you define in the tag. A workflow will do all the necessary steps:
4-
5-
```bash
6-
git checkout main
7-
git tag -a v1.14.1 -m "version 1.14.1"
8-
git push origin v1.14.1
9-
```
10-
11-
Do not use `git push --tags` as it can accidentally push tags from other repositories.
12-
13-
## Workflow Description
14-
15-
The logic is split in two jobs
16-
* First jobs perform tests. It runs on Windows runner since Linux runners don't have GPU, which is required by many tests.
17-
* Second job runs on Linux and creates builds minified library, creates github release, uploads release assets,
18-
updates version in npm package and submits package in the npm registry.
19-
20-
Pushing a tag triggers the publishing workflow, but it can also be triggered manually.
21-
The workflow searches for the most recent version tag matching [semantic version rules](https://classic.yarnpkg.com/en/docs/dependency-versions#toc-semantic-versioning),
22-
and must be prefixed with a `v`
23-
24-
There can be release versions such as `v1.14.0`, and release candidates, e.g. `v1.14.0-rc.1`.
25-
26-
In case of release version the action parses `CHANGELOG.md` and creates release notes based on current and last version.
27-
Release candidate versions do not generate release notes.
3+
1. Use [semantic version rules](https://classic.yarnpkg.com/en/docs/dependency-versions#toc-semantic-versioning) to define a version in `package.json`.
4+
2. Update `CHANGELOG.md`.
5+
3. Run `release.yml` by manual workflow dispatch. This builds the minified library, tags the commit based on the version in `package.json`, creates a GitHub release, uploads release assets, and publishes the build output to NPM.
286

297
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.
308

0 commit comments

Comments
 (0)