Update publish for 12.2.6

parent 911ba233
...@@ -976,7 +976,7 @@ jobs: ...@@ -976,7 +976,7 @@ jobs:
- run: npm i -g pnpm@${PNPM_VERSION} - run: npm i -g pnpm@${PNPM_VERSION}
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: ./scripts/publish-native.js $GITHUB_REF - run: ./scripts/publish-native.js $GITHUB_REF
- run: ./scripts/publish-release.sh - run: ./scripts/publish-release.js
testDeployE2E: testDeployE2E:
name: E2E (deploy) name: E2E (deploy)
......
...@@ -39,14 +39,22 @@ const cwd = process.cwd() ...@@ -39,14 +39,22 @@ const cwd = process.cwd()
`npm publish ${path.join( `npm publish ${path.join(
nativePackagesDir, nativePackagesDir,
platform platform
)} --access public ${ )} --access public --tag next-12-2-6`
gitref.includes('canary') ? ' --tag canary' : ''
}`
) )
} catch (err) { } catch (err) {
// don't block publishing other versions on single platform error // don't block publishing other versions on single platform error
console.error(`Failed to publish`, platform) console.error(`Failed to publish`, platform)
throw err
if (
err.message &&
err.message.includes(
'You cannot publish over the previously published versions'
)
) {
console.error('Ignoring already published error', platform)
} else {
throw err
}
} }
// lerna publish in next step will fail if git status is not clean // lerna publish in next step will fail if git status is not clean
execSync( execSync(
...@@ -75,7 +83,7 @@ const cwd = process.cwd() ...@@ -75,7 +83,7 @@ const cwd = process.cwd()
`npm publish ${path.join( `npm publish ${path.join(
wasmDir, wasmDir,
`pkg-${wasmTarget}` `pkg-${wasmTarget}`
)} --access public ${gitref.includes('canary') ? ' --tag canary' : ''}` )} --access public --tag next-12-2-6`
) )
} }
......
#!/usr/bin/env node
// @ts-check
const path = require('path')
const { readdir } = require('fs/promises')
const { execSync } = require('child_process')
const { readJson } = require('fs-extra')
const cwd = process.cwd()
;(async function () {
let isCanary = true
if (!process.env.NPM_TOKEN) {
console.log('No NPM_TOKEN, exiting...')
return
}
try {
const tagOutput = execSync('git describe --exact-match').toString()
console.log(tagOutput)
if (tagOutput.trim().startsWith('v')) {
isCanary = tagOutput.includes('-canary')
}
} catch (err) {
console.log(err)
if (err.message && err.message.includes('no tag exactly matches')) {
console.log('Nothing to publish, exiting...')
return
}
throw err
}
console.log(`Publishing ${isCanary ? 'canary' : 'stable'}`)
const packagesDir = path.join(cwd, 'packages')
const packageDirs = await readdir(packagesDir)
const publish = async (pkg, retry = 0) => {
try {
execSync(
`npm publish ${path.join(
packagesDir,
pkg
)} --access public --tag next-12-2-6`
)
} catch (err) {
console.error(`Failed to publish ${pkg}`, err)
if (
err.message &&
err.message.includes(
'You cannot publish over the previously published versions'
)
) {
console.error('Ignoring already published error', pkg)
return
}
if (retry < 3) {
const retryDelaySeconds = 15
console.log(`retrying in ${retryDelaySeconds}s`)
await new Promise((resolve) =>
setTimeout(resolve, retryDelaySeconds * 1000)
)
await publish(pkg, retry + 1)
}
throw err
}
}
for (const packageDir of packageDirs) {
const pkgJson = await readJson(
path.join(packagesDir, packageDir, 'package.json')
)
if (pkgJson.private) {
console.log(`Skipping private package ${packageDir}`)
continue
}
await publish(packageDir)
}
})()
#!/bin/bash
git describe --exact-match
if [[ ! $? -eq 0 ]];then
echo "Nothing to publish, exiting.."
exit 0;
fi
if [[ -z "$NPM_TOKEN" ]];then
echo "No NPM_TOKEN, exiting.."
exit 0;
fi
if [[ $(git describe --exact-match 2> /dev/null || :) =~ -canary ]];
then
echo "Publishing canary"
yarn run lerna publish from-git --npm-tag canary --no-git-reset --no-verify-access --yes
# Make sure to exit script with code 1 if publish failed
if [[ ! $? -eq 0 ]];then
exit 1;
fi
else
echo "Did not publish canary"
fi
if [[ ! $(git describe --exact-match 2> /dev/null || :) =~ -canary ]];then
echo "Publishing stable"
yarn run lerna publish from-git --no-git-reset --no-verify-access --yes
# Make sure to exit script with code 1 if publish failed
if [[ ! $? -eq 0 ]];then
exit 1;
fi
else
echo "Did not publish stable"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment