chore: use release-please workflow (#8375)

This commit is contained in:
jrandolf 2022-05-19 18:14:47 +02:00 committed by GitHub
parent d4321e53c9
commit 1ae3da6064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 120 deletions

View File

@ -1,66 +0,0 @@
name: publish-on-tag
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- 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 registry 'https://wombat-dressing-room.appspot.com/'
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
echo "Publishing puppeteer"
npm publish
# DEPRECATED_RANGE=$(node utils/get_deprecated_version_range.js)
# echo "Deprecating old puppeteer versions: $DEPRECATED_RANGE"
# npm deprecate puppeteer@$DEPRECATED_RANGE "Version no longer supported. Upgrade to @latest"
- name: Publish puppeteer-core
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER_CORE}}
run: |
utils/prepare_puppeteer_core.js
npm config set registry 'https://wombat-dressing-room.appspot.com/'
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
npm publish
post-publish:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure git
run: |
git config --global user.name 'Puppeteer Bot'
git config --global user.email '<puppeteer@chromium.org>'
- name: Append `-post` to version
id: post-version
run: |
npm version --no-git-tag-version --no-commit-hooks "$(jq -r .version ./package.json)-post"
echo ::set-output name=VERSION::$(jq -r .version ./package.json)
- name: Build
run: |
npm install
npm run build
npm run doc
- name: Commit and push
run: |
git add -A
git commit -m "chore: bump version to ${{ steps.post-version.outputs.VERSION }}"
git push

View File

@ -1,33 +1,85 @@
name: release name: Release
on: workflow_dispatch on:
push:
branches:
- main
jobs: jobs:
release: release-pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: outputs:
contents: write release_created: ${{ steps.release.outputs.release_created }}
pull-requests: write
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Configure git - name: Remove `-post` suffix
run: | run: node utils/remove_version_suffix.js
git config --global user.name 'Puppeteer Bot'
git config --global user.email '<puppeteer@chromium.org>'
- name: Release - name: Release
uses: google-github-actions/release-please-action@v3
id: release id: release
with:
release-type: node
package-name: puppeteer
command: github-release
publish:
needs: release-pr
if: ${{ needs.release-pr.outputs.release_created }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Build puppeteer
run: npm run build
- name: Publish puppeteer
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER}}
run: |
npm config set registry 'https://wombat-dressing-room.appspot.com/'
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
echo "Publishing puppeteer"
npm publish
# DEPRECATED_RANGE=$(node utils/get_deprecated_version_range.js)
# echo "Deprecating old puppeteer versions: $DEPRECATED_RANGE"
# npm deprecate puppeteer@$DEPRECATED_RANGE "Version no longer supported. Upgrade to @latest"
- name: Publish puppeteer-core
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER_CORE}}
run: |
utils/prepare_puppeteer_core.js
npm config set registry 'https://wombat-dressing-room.appspot.com/'
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
npm publish
post-publish:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Append `-post` to version
id: post-version
run: |
npm version --no-git-tag-version --no-commit-hooks "$(jq -r .version ./package.json)-post"
echo ::set-output name=VERSION::$(jq -r .version ./package.json)
- name: Build
run: | run: |
npm install npm install
npm run release npm run build
echo ::set-output name=VERSION::$(jq -r .version ./package.json) npm run doc
- name: Create pull request - name: Configure git
uses: peter-evans/create-pull-request@v4 run: |
with: git config --global user.name 'actions-bot'
branch: releases/v${{ steps.release.outputs.VERSION }} git config --global user.email '<github-actions-bot@google.com>'
delete-branch: true - name: Commit and push
commit-message: 'chore(release): mark v${{ steps.release.outputs.VERSION }}' run: |
title: 'chore(release): mark v${{ steps.release.outputs.VERSION }}' git add -A
body: '' git commit -m "chore: bump version to ${{ steps.post-version.outputs.VERSION }}"
labels: release git push
reviewers: jrandolf, OrKoN, ergunsh

View File

@ -1,30 +0,0 @@
name: tag-on-release
on:
pull_request:
types:
- closed
branches:
- 'releases/**'
jobs:
tag:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get version
id: get-version
run: |
echo ::set-output name=VERSION::$(jq -r .version ./package.json)
- name: Generate latest changelog
run: node utils/get_latest_changelog.js > ${{ steps.get-version.outputs.VERSION }}-CHANGELOG.txt
- name: Tag and release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.get-version.outputs.VERSION }}
tag_name: v${{ steps.get-version.outputs.VERSION }}
body_path: ${{ steps.get-version.outputs.VERSION }}-CHANGELOG.txt

View File

@ -63,7 +63,6 @@
"ensure-correct-devtools-protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package", "ensure-correct-devtools-protocol-revision": "ts-node -s scripts/ensure-correct-devtools-protocol-package",
"ensure-pinned-deps": "ts-node -s scripts/ensure-pinned-deps", "ensure-pinned-deps": "ts-node -s scripts/ensure-pinned-deps",
"test-types-file": "ts-node -s scripts/test-ts-definition-files.ts", "test-types-file": "ts-node -s scripts/test-ts-definition-files.ts",
"release": "node utils/remove_version_suffix.js && standard-version --commit-all",
"build-docs-production": "cd website && npm install && npm run build" "build-docs-production": "cd website && npm install && npm run build"
}, },
"files": [ "files": [
@ -133,7 +132,6 @@
"prettier": "2.6.2", "prettier": "2.6.2",
"sinon": "13.0.2", "sinon": "13.0.2",
"source-map-support": "0.5.21", "source-map-support": "0.5.21",
"standard-version": "9.3.2",
"text-diff": "1.0.1", "text-diff": "1.0.1",
"ts-node": "10.7.0", "ts-node": "10.7.0",
"typescript": "4.6.4" "typescript": "4.6.4"