Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5591468

Browse files
committed
chore(scripts): auto create autoversion PR from release script
Ref#12465
1 parentc24b562 commit5591468

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed

‎scripts/release.sh‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ log "Release tags for ${new_version} created successfully and pushed to ${remote
294294

295295
log
296296
# Write to a tmp file for ease of debugging.
297-
release_json_file=$(mktemp -t coder-release.json)
297+
release_json_file=$(mktemp -t coder-release.json.XXXXXX)
298298
log"Writing release JSON to${release_json_file}"
299299
jq -n \
300300
--argjson dry_run"${dry_run}" \
@@ -310,6 +310,49 @@ maybedryrun "${dry_run}" cat "${release_json_file}" |
310310
log
311311
log"Release workflow started successfully!"
312312

313+
log
314+
log"Would you like for me to create a pull request for you to automatically bump the version numbers in the docs?"
315+
while [[!${create_pr:-}=~ ^[YyNn]$ ]];do
316+
read -p"Create PR? (y/n)" -n 1 -r create_pr
317+
log
318+
done
319+
if [[${create_pr}=~ ^[Yy]$ ]];then
320+
pr_branch=autoversion/${new_version}
321+
title="docs: bump${channel} version to${new_version}"
322+
body="This PR was automatically created by the release script.
323+
324+
Please review the changes and merge if they look good and the release is complete.
325+
326+
You can follow the release progress [here](https://github.com/coder/coder/actions/workflows/release.yaml) and view the published release [here](https://github.com/coder/coder/releases/tag/${new_version}) (once complete)."
327+
328+
log
329+
log"Creating branch\"${pr_branch}\" and updating versions..."
330+
331+
create_pr_stash=0
332+
if! git diff --quiet --exit-code -- docs;then
333+
maybedryrun"${dry_run}" git stash push --message"scripts/release.sh: autostash (autoversion)" -- docs
334+
create_pr_stash=1
335+
fi
336+
maybedryrun"${dry_run}" git checkout -b"${pr_branch}""${remote}/${branch}"
337+
execrelative go run ./release autoversion --channel"${channel}""${new_version}" --dry-run
338+
maybedryrun"${dry_run}" git add docs
339+
maybedryrun"${dry_run}" git commit -m"${title}"
340+
# Return to previous branch.
341+
maybedryrun"${dry_run}" git checkout -
342+
if((create_pr_stash));then
343+
maybedryrun"${dry_run}" git stash pop
344+
fi
345+
346+
log"Creating pull request..."
347+
maybedryrun"${dry_run}" gh pr create \
348+
--assignee"@me" \
349+
--reviewer bpmct,stirby \
350+
--base"${branch}" \
351+
--head"${pr_branch}" \
352+
--title"${title}" \
353+
--body"${body}"
354+
fi
355+
313356
if((dry_run));then
314357
# We can't watch the release.yaml workflow if we're in dry-run mode.
315358
exit 0

‎scripts/release/main.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (r *releaseCommand) autoversionFile(ctx context.Context, file, channel, ver
385385
// Utilize the index where the match was found to replace the correct part. The only
386386
// match group is the version.
387387
ifmatch:=matchRe.FindStringSubmatchIndex(line);match!=nil {
388-
logger.Info(ctx,"updating version number","line_number",i+1,"match",match)
388+
logger.Info(ctx,"updating version number","line_number",i+1,"match",match,"old_version",line[match[2]:match[3]])
389389
lines[i]=line[:match[2]]+version+line[match[3]:]
390390
matchRe=nil
391391
break

‎scripts/release/tag_version.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ fi
191191

192192
# Ensure the ref is in the release branch.
193193
branch_contains_ref=$(git branch --contains"${ref}" --list"${release_branch}" --format='%(refname)')
194-
if [[-z$branch_contains_ref ]];then
194+
if((!dry_run))&&[[-z$branch_contains_ref ]];then
195195
error"Provided ref (${ref_name}) is not in the required release branch (${release_branch})."
196196
fi
197197

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#Some documentation
2+
3+
1. Run the following command to install the chart in your cluster.
4+
5+
For the**mainline** Coder release:
6+
7+
<!-- autoversion(mainline): "--version [version] # trailing comment!"-->
8+
9+
```shell
10+
helm install coder coder-v2/coder \
11+
--namespace coder \
12+
--values values.yaml \
13+
--version 2.10.0# trailing comment!
14+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Some documentation
2+
3+
1. Run the following command to install the chart in your cluster.
4+
5+
For the **mainline** Coder release:
6+
7+
<!-- autoversion(mainline): "--version [version] # trailing comment!" -->
8+
9+
```shell
10+
helm install coder coder-v2/coder \
11+
--namespace coder \
12+
--values values.yaml \
13+
--version 2.11.1 # trailing comment!
14+
```

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp