chore: automate publishing on new Git tags (#6536)

Issues: #6482
This commit is contained in:
Mathias Bynens 2020-10-23 14:40:14 +02:00 committed by GitHub
parent 5e5fed1deb
commit 8e9970df67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 11 deletions

30
.github/workflows/publish-on-tag.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: publish-on-tag
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish puppeteer
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER}}
run: |
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
npm publish
- name: Publish puppeteer-core
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER_CORE}}
run: |
utils/prepare_puppeteer_core.js
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
npm publish

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
registry=https://wombat-dressing-room.appspot.com/
access=public

View File

@ -286,17 +286,8 @@ Releasing to npm consists of the following phases:
7. Once merged, publish the release notes using [GitHub's “draft new release tag” option](https://github.com/puppeteer/puppeteer/releases/new).
- **NOTE**: tag names are prefixed with `'v'`, e.g. for version `1.4.0` the tag is `v1.4.0`.
- For the “raw notes” section, use `git log --pretty="%h - %s" v2.0.0..HEAD`.
2. Publish `puppeteer` to npm.
1. On your local machine, pull from [upstream](https://github.com/puppeteer/puppeteer) and make sure the last commit is the one just merged.
2. Run `git status` and make sure there are no untracked files.
- **WHY**: this is to avoid adding unnecessary files to the npm package.
3. Run [`npx pkgfiles`](https://www.npmjs.com/package/pkgfiles) to make sure you don't publish anything unnecessary.
4. Run `npm publish`. This publishes the `puppeteer` package.
3. Publish `puppeteer-core` to npm.
1. Run `./utils/prepare_puppeteer_core.js`. The script changes the name inside `package.json` to `puppeteer-core`.
2. Run `npm publish`. This publishes the `puppeteer-core` package.
3. Run `git reset --hard` to reset the changes to `package.json`.
4. Source Code: mark post-release.
8. As soon as the Git tag is created by completing the previous step, our CI automatically `npm publish`es the new releases for both the `puppeteer` and `puppeteer-core` packages.
2. Source Code: mark post-release.
1. Bump `package.json` version to `-post` version, run `npm run doc` to update the “released APIs” section at the top of `docs/api.md` accordingly, and send a PR titled `'chore: bump version to vXXX.YYY.ZZZ-post'` ([example](https://github.com/puppeteer/puppeteer/commit/d02440d1eac98028e29f4e1cf55413062a259156))
- **NOTE**: no other commits should be landed in-between release commit and bump commit.

View File

@ -26,6 +26,7 @@
"lint": "npm run eslint && npm run tsc && npm run doc && npm run commitlint",
"doc": "node utils/doclint/cli.js",
"clean-lib": "rm -rf lib",
"build": "npm run tsc",
"tsc": "npm run clean-lib && tsc --version && npm run tsc-cjs && npm run tsc-esm",
"tsc-cjs": "tsc -b src/tsconfig.cjs.json",
"tsc-esm": "tsc -b src/tsconfig.esm.json",