Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
cb1da96e
Unverified
Commit
cb1da96e
authored
Sep 27, 2022
by
JJ Kasper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update publish for 12.2.6
parent
911ba233
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
44 deletions
+98
-44
build_test_deploy.yml
.github/workflows/build_test_deploy.yml
+1
-1
publish-native.js
scripts/publish-native.js
+13
-5
publish-release.js
scripts/publish-release.js
+84
-0
publish-release.sh
scripts/publish-release.sh
+0
-38
No files found.
.github/workflows/build_test_deploy.yml
View file @
cb1da96e
...
@@ -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)
...
...
scripts/publish-native.js
View file @
cb1da96e
...
@@ -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
`
)
)
}
}
...
...
scripts/publish-release.js
0 → 100755
View file @
cb1da96e
#!/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
)
}
})()
scripts/publish-release.sh
deleted
100755 → 0
View file @
911ba233
#!/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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment