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
2f210d44
Commit
2f210d44
authored
Mar 06, 2024
by
JJ Kasper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update release workflow
parent
f564deef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
109 deletions
+16
-109
trigger_release.yml
.github/workflows/trigger_release.yml
+5
-4
start-release.js
scripts/start-release.js
+11
-105
No files found.
.github/workflows/trigger_release.yml
View file @
2f210d44
...
@@ -29,7 +29,7 @@ name: Trigger Release
...
@@ -29,7 +29,7 @@ name: Trigger Release
env
:
env
:
NAPI_CLI_VERSION
:
2.14.7
NAPI_CLI_VERSION
:
2.14.7
TURBO_VERSION
:
1.1
1.3
TURBO_VERSION
:
1.1
2.2
NODE_LTS_VERSION
:
20
NODE_LTS_VERSION
:
20
jobs
:
jobs
:
...
@@ -45,14 +45,15 @@ jobs:
...
@@ -45,14 +45,15 @@ jobs:
environment
:
release-${{ github.event.inputs.releaseType || 'canary' }}
environment
:
release-${{ github.event.inputs.releaseType || 'canary' }}
steps
:
steps
:
-
name
:
Setup node
-
name
:
Setup node
uses
:
actions/setup-node@v
3
uses
:
actions/setup-node@v
4
with
:
with
:
node-version
:
18
node-version
:
18
check-latest
:
true
check-latest
:
true
-
uses
:
actions/checkout@v
3
-
uses
:
actions/checkout@v
4
with
:
with
:
fetch-depth
:
25
fetch-depth
:
25
persist-credentials
:
false
# to allow start-release to override the git credentials
-
name
:
Get commit of the latest tag
-
name
:
Get commit of the latest tag
run
:
echo "LATEST_TAG_COMMIT=$(git rev-list -n 1 $(git describe --tags --abbrev=0))" >> $GITHUB_ENV
run
:
echo "LATEST_TAG_COMMIT=$(git rev-list -n 1 $(git describe --tags --abbrev=0))" >> $GITHUB_ENV
...
@@ -77,7 +78,7 @@ jobs:
...
@@ -77,7 +78,7 @@ jobs:
-
id
:
get-store-path
-
id
:
get-store-path
run
:
echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT
run
:
echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT
-
uses
:
actions/cache@v
3
-
uses
:
actions/cache@v
4
timeout-minutes
:
5
timeout-minutes
:
5
id
:
cache-pnpm-store
id
:
cache-pnpm-store
with
:
with
:
...
...
scripts/start-release.js
View file @
2f210d44
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
const
execa
=
require
(
'execa'
)
const
execa
=
require
(
'execa'
)
const
resolveFrom
=
require
(
'resolve-from'
)
const
resolveFrom
=
require
(
'resolve-from'
)
const
ansiEscapes
=
require
(
'ansi-escapes'
)
function
getPromptErrorDetails
(
rawAssertion
,
mostRecentChunk
)
{
const
assertion
=
rawAssertion
.
toString
().
trim
()
const
mostRecent
=
(
mostRecentChunk
||
''
).
trim
()
return
`Waiting for:\n "
${
assertion
}
"\nmost recent chunk was:\n "
${
mostRecent
}
"`
}
async
function
waitForPrompt
(
cp
,
rawAssertion
,
timeout
=
120
_000
)
{
let
assertion
if
(
typeof
rawAssertion
===
'string'
)
{
assertion
=
(
chunk
)
=>
chunk
.
includes
(
rawAssertion
)
}
else
if
(
rawAssertion
instanceof
RegExp
)
{
assertion
=
(
chunk
)
=>
rawAssertion
.
test
(
chunk
)
}
else
{
assertion
=
rawAssertion
}
return
new
Promise
((
resolve
,
reject
)
=>
{
let
mostRecentChunk
=
'NO CHUNKS SO FAR'
console
.
log
(
'Waiting for prompt...'
)
const
handleTimeout
=
setTimeout
(()
=>
{
cleanup
()
const
promptErrorDetails
=
getPromptErrorDetails
(
rawAssertion
,
mostRecentChunk
)
reject
(
new
Error
(
`Timed out after
${
timeout
}
ms in waitForPrompt.
${
promptErrorDetails
}
`
)
)
},
timeout
)
const
onComplete
=
()
=>
{
cleanup
()
const
promptErrorDetails
=
getPromptErrorDetails
(
rawAssertion
,
mostRecentChunk
)
reject
(
new
Error
(
`Process exited before prompt was found in waitForPrompt.
${
promptErrorDetails
}
`
)
)
}
const
onData
=
(
rawChunk
)
=>
{
const
chunk
=
rawChunk
.
toString
()
mostRecentChunk
=
chunk
console
.
log
(
'> '
+
chunk
)
if
(
assertion
(
chunk
))
{
cleanup
()
resolve
()
}
}
const
cleanup
=
()
=>
{
cp
.
stdout
?.
off
(
'data'
,
onData
)
cp
.
stderr
?.
off
(
'data'
,
onData
)
cp
.
off
(
'close'
,
onComplete
)
cp
.
off
(
'exit'
,
onComplete
)
clearTimeout
(
handleTimeout
)
}
cp
.
stdout
?.
on
(
'data'
,
onData
)
cp
.
stderr
?.
on
(
'data'
,
onData
)
cp
.
on
(
'close'
,
onComplete
)
cp
.
on
(
'exit'
,
onComplete
)
})
}
const
SEMVER_TYPES
=
[
'patch'
,
'minor'
,
'major'
]
const
SEMVER_TYPES
=
[
'patch'
,
'minor'
,
'major'
]
...
@@ -126,41 +53,20 @@ async function main() {
...
@@ -126,41 +53,20 @@ async function main() {
})
})
console
.
log
(
`Running pnpm release-
${
isCanary
?
'canary'
:
'stable'
}
...`
)
console
.
log
(
`Running pnpm release-
${
isCanary
?
'canary'
:
'stable'
}
...`
)
const
child
=
execa
(
`pnpm release-
${
isCanary
?
'canary'
:
'stable'
}
`
,
{
const
child
=
execa
(
stdio
:
'pipe'
,
isCanary
shell
:
true
,
?
`pnpm lerna version
${
})
semverType
===
'minor'
?
'preminor'
:
'prerelease'
}
--preid canary --force-publish -y && pnpm release --pre --skip-questions --show-url`
:
`pnpm lerna version
${
semverType
}
--force-publish -y`
,
{
stdio
:
'pipe'
,
shell
:
true
,
}
)
child
.
stdout
.
pipe
(
process
.
stdout
)
child
.
stdout
.
pipe
(
process
.
stdout
)
child
.
stderr
.
pipe
(
process
.
stderr
)
child
.
stderr
.
pipe
(
process
.
stderr
)
if
(
isCanary
)
{
console
.
log
(
"Releasing canary: enter 'y'
\n
"
)
child
.
stdin
.
write
(
'y
\
n'
)
}
else
{
console
.
log
(
'Wait for the version prompt to show up'
)
await
waitForPrompt
(
child
,
'Select a new version'
)
console
.
log
(
'Releasing stable'
)
if
(
semverType
===
'minor'
)
{
console
.
log
(
'Releasing minor: cursor down > 1
\
n'
)
child
.
stdin
.
write
(
ansiEscapes
.
cursorDown
(
1
))
}
if
(
semverType
===
'major'
)
{
console
.
log
(
'Releasing major: curser down > 1'
)
child
.
stdin
.
write
(
ansiEscapes
.
cursorDown
(
1
))
console
.
log
(
'Releasing major: curser down > 2'
)
child
.
stdin
.
write
(
ansiEscapes
.
cursorDown
(
1
))
}
if
(
semverType
===
'patch'
)
{
console
.
log
(
'Releasing patch: cursor stay
\
n'
)
}
console
.
log
(
'Enter newline'
)
child
.
stdin
.
write
(
'
\
n'
)
await
waitForPrompt
(
child
,
'Changes:'
)
console
.
log
(
'Enter y'
)
child
.
stdin
.
write
(
'y
\
n'
)
}
console
.
log
(
'Await child process...'
)
await
child
await
child
console
.
log
(
'Release process is finished'
)
console
.
log
(
'Release process is finished'
)
}
}
...
...
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