chore: update canary_version to work with new setup (#200)

This commit is contained in:
Dmitry Gozman 2021-01-21 13:02:45 -08:00 коммит произвёл GitHub
Родитель a8f6c6af20
Коммит 281119ec63
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 23 удалений

8
.github/workflows/publish_canary.yml поставляемый
Просмотреть файл

@ -23,6 +23,8 @@ jobs:
git config user.email "devops@playwright.dev" git config user.email "devops@playwright.dev"
git config user.name "playwright-devops" git config user.name "playwright-devops"
npm version "$(node utils/canary_version.js)" npm version "$(node utils/canary_version.js)"
- run: npm publish --tag next # - run: npm publish --tag next
env: # env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run:
node -p "require('./package.json').version"

Просмотреть файл

@ -14,23 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
// This script generates the canary version to publish to npm, based on the verison of playwright. const { execSync } = require('child_process');
// It should not be used to publish a release version. const timestamp = execSync('git show -s --format=%ct HEAD', {
// stdio: ['ignore', 'pipe', 'ignore']
// 1. Takes timestamp from the playwright@next version, so that language packages }).toString('utf8').trim() + '000';
// have easier time syncing between the two. const packageJSON = require('../package.json');
// console.log(packageJSON.version + '-' + timestamp);
// 2. Appends git hash:
// - Avoids accidentally generating a release version.
// - Ensures that we can publish packages that have the same version of
// both playwright and playwright-cli, but different content.
const childProcess = require('child_process');
const json = require('../package.json');
const hash = childProcess.execSync('git rev-parse --short HEAD').toString().trim();
if (json.dependencies['playwright-core'].includes('next')) {
const timestamp = json.dependencies['playwright-core'].replace(/.*next\./, '');
console.log(json.version + '-' + timestamp + '-' + hash);
} else {
console.log(json.version + '-' + hash);
}