Skip to content

Commit 55f29cf

Browse files
committed
feat: add dry run option to release-prep.sh
1 parent 27d7b83 commit 55f29cf

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
This PR is to generate a new release of `code-server` at `0.0.0`
1+
<!-- Note: this variable $CODE_SERVER_VERSION_TO_UPDATE will be set when you run the release-prep.sh script with `yarn release:prep` -->
2+
This PR is to generate a new release of `code-server` at `$CODE_SERVER_VERSION_TO_UPDATE`
23

34
## Screenshot
45

56
TODO
67

78
## TODOs
89

9-
- [ ] update the AUR package
10-
- [ ] upload assets to draft release
1110
- [ ] test locally
11+
- [ ] upload assets to draft release
1212
- [ ] double-check github release tag is the commit with artifacts
1313
- [ ] publish release
1414
- [ ] merge PR
1515
- [ ] update the homebrew package
16+
- [ ] update the AUR package

ci/build/release-prep.sh

+20-11
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@
55
# 2. Update the version of code-server (package.json, docs, etc.)
66
# 3. Update the code coverage badge in the README
77
# 4. Open a draft PR using the release_template.md and view in browser
8+
# If you want to perform a dry run of this script run DRY_RUN=0 yarn release:prep
89

910
set -euo pipefail
1011

1112
main() {
13+
if [ "${DRY_RUN-}" = 1 ]; then
14+
echo "Performing a dry run..."
15+
CMD="echo"
16+
else
17+
CMD=''
18+
fi
19+
1220
cd "$(dirname "$0")/../.."
1321

1422
# Check that $GITHUB_TOKEN is set
15-
if [[ -z "${GITHUB_TOKEN}" ]]; then
23+
if [[ -z ${GITHUB_TOKEN-} ]]; then
1624
echo "We couldn't find an environment variable under GITHUB_TOKEN."
1725
echo "This is needed for our scripts that use hub."
1826
echo -e "See docs regarding GITHUB_TOKEN here under 'GitHub OAuth authentication': https://hub.github.com/hub.1.html"
@@ -73,31 +81,32 @@ main() {
7381
# I can't tell you why but
7482
# when searching with rg, the version needs to in this format: '3\.7\.5'
7583
# that's why we have the parameter expansion with the regex
76-
rg -g '!yarn.lock' -g '!*.svg' --files-with-matches "${CODE_SERVER_CURRENT_VERSION//\./\\.}" | xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
84+
$CMD rg -g '!yarn.lock' -g '!*.svg' --files-with-matches "${CODE_SERVER_CURRENT_VERSION//\./\\.}" | $CMD xargs sd "$CODE_SERVER_CURRENT_VERSION" "$CODE_SERVER_VERSION_TO_UPDATE"
7785

7886
# Ensure the tests are passing and code coverage is up-to-date
7987
echo -e "Running unit tests and updating code coverage...\n"
80-
yarn test:unit
88+
$CMD yarn test:unit
8189
# Updates the Lines badge in the README
82-
yarn badges
90+
$CMD yarn badges
8391
# Updates the svg to be green for the badge
84-
sd "red.svg" "green.svg" ../../README.md
92+
$CMD sd "red.svg" "green.svg" ../../README.md
8593

86-
git add . && git commit -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
94+
$CMD git add . && $CMD git commit -am "chore(release): bump version to $CODE_SERVER_VERSION_TO_UPDATE"
8795

8896
CURRENT_BRANCH=$(git branch --show-current)
8997
# Note: we need to set upstream as well or the gh pr create step will fail
9098
# See: https://github.com/cli/cli/issues/575
91-
git push -u origin "$CURRENT_BRANCH"
99+
$CMD git push -u origin "$CURRENT_BRANCH"
92100

93-
RELEASE_TEMPLATE_STRING=$(cat ../../.github/PULL_REQUEST_TEMPLATE/release_template.md)
101+
# This runs from the root so that's why we use this path vs. ../../
102+
RELEASE_TEMPLATE_STRING=$(cat ./.github/PULL_REQUEST_TEMPLATE/release_template.md)
94103

95-
echo -e "Opening a draft PR on GitHub\n"
104+
echo -e "\nOpening a draft PR on GitHub"
96105
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
97-
gh pr create --base main --title "release: $CODE_SERVER_VERSION_TO_UPDATE" --body "$RELEASE_TEMPLATE_STRING" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
106+
$CMD gh pr create --base main --title "release: $CODE_SERVER_VERSION_TO_UPDATE" --body "$RELEASE_TEMPLATE_STRING" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
98107

99108
# Open PR in browser
100-
gh pr view --web
109+
$CMD gh pr view --web
101110
}
102111

103112
main "$@"

0 commit comments

Comments
 (0)