devops: start releasing from Github Actions (#1890)
This patch: - removes releasing from Travis CI - sets up a new GH Action that releases @next version from tip-of-tree Once this GH Action proves to be working, we'll setup a `publish_release.yml` workflow that will be triggered only by **release** github events and that will publish released version with `LATEST` tag. NOTE: this workflow does not actually run publishing - we're doing `--dry-run` for now to see how it works in `//utils/publish_all_packages.sh`.
This commit is contained in:
parent
80a7fcd2de
commit
ac8a30c526
27
.github/workflows/publish_canary.yml
vendored
Normal file
27
.github/workflows/publish_canary.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
name: "canary"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-canary:
|
||||||
|
name: "publish"
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 10
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- uses: microsoft/playwright-github-action@v1
|
||||||
|
- run: npm ci
|
||||||
|
- run: node utils/update_version.js --next
|
||||||
|
- run: utils/publish_all_packages.sh --tip-of-tree
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
|
@ -40,12 +40,3 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- node_js: '12'
|
- node_js: '12'
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- node utils/update_version.js --next
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
skip_cleanup: true
|
|
||||||
provider: script
|
|
||||||
script: utils/publish_all_packages.sh --tip-of-tree
|
|
||||||
on:
|
|
||||||
branch: master
|
|
||||||
|
|
|
||||||
|
|
@ -25,63 +25,52 @@ if ! command -v npm >/dev/null; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ (-n $CI) && (-n $NPM_AUTH_TOKEN) ]]; then
|
|
||||||
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > $HOME/.npmrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! npm whoami >/dev/null 2>&1; then
|
if ! npm whoami >/dev/null 2>&1; then
|
||||||
echo "ERROR: NPM failed to log in"
|
echo "ERROR: NPM is not logged in."
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
UPSTREAM_SHA=$(git ls-remote https://github.com/microsoft/playwright --tags master | cut -f1)
|
|
||||||
CURRENT_SHA=$(git rev-parse HEAD)
|
|
||||||
|
|
||||||
if [[ "${UPSTREAM_SHA}" != "${CURRENT_SHA}" ]]; then
|
|
||||||
echo "REFUSING TO PUBLISH: this is not tip-of-tree"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
NPM_PUBLISH_TAG="next"
|
||||||
|
VERSION=$(node -e 'console.log(require("./package.json").version)')
|
||||||
|
|
||||||
if [[ $1 == "--release" ]]; then
|
if [[ $1 == "--release" ]]; then
|
||||||
if [[ -n $CI ]]; then
|
|
||||||
echo "Found \$CI env - cannot publish real release from CI"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -n $(git status -s) ]]; then
|
if [[ -n $(git status -s) ]]; then
|
||||||
echo "ERROR: git status is dirty; some uncommitted changes or untracked files"
|
echo "ERROR: git status is dirty; some uncommitted changes or untracked files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
VERSION=$(node -e 'console.log(require("./package.json").version)')
|
# Ensure package version does not contain dash.
|
||||||
echo -n "Publish Playwright v${VERSION} (y/N)? "
|
if [[ "${VERSION}" == *-* ]]; then
|
||||||
read ANSWER
|
echo "ERROR: cannot publish pre-release version with --release flag"
|
||||||
if [[ "$ANSWER" != "y" ]]; then
|
exit 1
|
||||||
echo "Bailing out."
|
fi
|
||||||
|
NPM_PUBLISH_TAG="latest"
|
||||||
|
elif [[ $1 == "--tip-of-tree" ]]; then
|
||||||
|
# Ensure package version contains dash.
|
||||||
|
if [[ "${VERSION}" != *-* ]]; then
|
||||||
|
echo "ERROR: cannot publish release version with --tip-of-tree flag"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
npm run clean
|
# Ensure this is actually tip-of-tree.
|
||||||
npm publish .
|
UPSTREAM_SHA=$(git ls-remote https://github.com/microsoft/playwright --tags master | cut -f1)
|
||||||
npm publish packages/playwright-firefox
|
CURRENT_SHA=$(git rev-parse HEAD)
|
||||||
npm publish packages/playwright-webkit
|
if [[ "${UPSTREAM_SHA}" != "${CURRENT_SHA}" ]]; then
|
||||||
npm publish packages/playwright-chromium
|
echo "REFUSING TO PUBLISH: this is not tip-of-tree"
|
||||||
npm publish packages/playwright
|
|
||||||
echo "Done."
|
|
||||||
elif [[ $1 == "--tip-of-tree" ]]; then
|
|
||||||
if [[ -z $CI ]]; then
|
|
||||||
echo "Did not find \$CI env - cannot publish tip-of-tree release not from CI"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
npm run clean
|
NPM_PUBLISH_TAG="next"
|
||||||
npm publish . --tag="next"
|
|
||||||
npm publish packages/playwright-firefox --tag="next"
|
|
||||||
npm publish packages/playwright-webkit --tag="next"
|
|
||||||
npm publish packages/playwright-chromium --tag="next"
|
|
||||||
npm publish packages/playwright --tag="next"
|
|
||||||
echo "Done."
|
|
||||||
else
|
else
|
||||||
echo "unknown argument - '$1'"
|
echo "unknown argument - '$1'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
npm run clean
|
||||||
|
npm publish . --tag="${NPM_PUBLISH_TAG}" --dry-run
|
||||||
|
npm publish packages/playwright-firefox --tag="${NPM_PUBLISH_TAG}" --dry-run
|
||||||
|
npm publish packages/playwright-webkit --tag="${NPM_PUBLISH_TAG}" --dry-run
|
||||||
|
npm publish packages/playwright-chromium --tag="${NPM_PUBLISH_TAG}" --dry-run
|
||||||
|
npm publish packages/playwright --tag="${NPM_PUBLISH_TAG}" --dry-run
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue