From 8e9970df67c3f7994ff33b97da1b1571d2a6f18d Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 23 Oct 2020 14:40:14 +0200 Subject: [PATCH] chore: automate publishing on new Git tags (#6536) Issues: #6482 --- .github/workflows/publish-on-tag.yml | 30 ++++++++++++++++++++++++++++ .npmrc | 2 ++ CONTRIBUTING.md | 13 ++---------- package.json | 1 + 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/publish-on-tag.yml create mode 100644 .npmrc diff --git a/.github/workflows/publish-on-tag.yml b/.github/workflows/publish-on-tag.yml new file mode 100644 index 00000000..b16c1be3 --- /dev/null +++ b/.github/workflows/publish-on-tag.yml @@ -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 diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..f4335b67 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +registry=https://wombat-dressing-room.appspot.com/ +access=public diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1abad264..2fd07037 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/package.json b/package.json index 718b1910..4b4440fd 100644 --- a/package.json +++ b/package.json @@ -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",