Skip to content

Commit ebc9778

Browse files
committed
fixup! Automate draft release
1 parent c3de376 commit ebc9778

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

ci/README.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ Any file and directory added into this tree should be documented here.
88

99
## Publishing a release
1010

11-
1. Update the version of code-server in `package.json` and push a commit
12-
1. CI will run and generate the `npm-package` and `release-packages` artifacts on the GH actions workflow
13-
1. Wait for this to complete
14-
1. Ensure `$GITHUB_TOKEN` is set
15-
1. Run `yarn release:github-draft` to download the artifacts into `./release-packages` and
16-
open your `$EDITOR` with the release notes template
11+
Make sure you have `$GITHUB_TOKEN` set and [hub](https://github.com/github/hub) installed.
12+
13+
1. Update the version of code-server in `package.json`
14+
1. Run `yarn release:github-draft` to create a GitHub draft release from the template with
15+
the updated version.
1716
1. Summarize the major changes in the release notes and link to the relevant issues.
18-
1. Exit your `$EDITOR` and a draft release will be created on github
17+
1. Push a commit updating the `package.json` version
18+
1. GitHub actions will generate the `npm-package` and `release-packages` artifacts
19+
1. Wait for this to complete
20+
1. Run `yarn release:github-assets` to download the artifacts and then upload them to the draft release
1921
1. Run some basic sanity tests on one of the released packages
2022
1. Publish the release
2123
1. CI will automatically grab the artifacts and then
@@ -78,9 +80,11 @@ You can disable minification by setting `MINIFY=`.
7880
- [./build/code-server-nfpm.sh](./build/code-server-nfpm.sh)
7981
- Entrypoint script for code-server for .deb and .rpm
8082
- [./build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`)
81-
- Downloads the release-package artifact for the current commit from CI
82-
- Uses [hub](https://github.com/github/hub) to create a draft release with the artifacts and
83-
opens your `$EDITOR` to edit with a default template.
83+
- Uses [hub](https://github.com/github/hub) to create a draft release with a template description
84+
- [./build/release-github-assets.sh](./build/release-github-assets.sh) (`yarn release:github-assets`)
85+
- Downloads the release-package artifacts for the current commit from CI
86+
- Uses [hub](https://github.com/github/hub) to upload the artifacts to the release
87+
specified in `package.json`
8488

8589
## release-container
8690

ci/build/release-github-assets.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Downloads the release artifacts from CI for the current
5+
# commit and then uploads them to the release with the version
6+
# in package.json.
7+
# You will need $GITHUB_TOKEN set.
8+
9+
main() {
10+
cd "$(dirname "$0")/../.."
11+
source ./ci/lib.sh
12+
13+
download_artifact release-packages ./release-packages
14+
local assets=(./release-packages/*)
15+
for i in "${!assets[@]}"; do
16+
assets[$i]="--attach=${assets[$i]}"
17+
done
18+
EDITOR=true hub release edit --draft "${assets[@]}" "v$(pkg_json_version)"
19+
}
20+
21+
main "$@"

ci/build/release-github-draft.sh

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# This script downloads the release artifacts from CI for the current
5-
# commit and then uses hub to create a draft release with them attached
6-
# for the current version against the current commit.
7-
# You will need $GITHUB_TOKEN set.
4+
# Creates a draft release with the template for the version in package.json
85

96
main() {
107
cd "$(dirname "$0")/../.."
118
source ./ci/lib.sh
129

13-
download_artifact release-packages ./release-packages
14-
local assets=(./release-packages/*)
15-
for i in "${!assets[@]}"; do
16-
assets[$i]="--attach=${assets[$i]}"
17-
done
1810
hub release create \
19-
--edit --file - \
11+
--file - \
2012
--draft "${assets[@]}" "v$(pkg_json_version)" << EOF
2113
v$(pkg_json_version)
2214

ci/dev/lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ main() {
77
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js")
88
stylelint $(git ls-files "*.css")
99
tsc --noEmit
10-
shellcheck -e SC2046,SC2164 $(git ls-files "*.sh")
10+
shellcheck -e SC2046,SC2164,SC2154 $(git ls-files "*.sh")
1111
}
1212

1313
main "$@"

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"release": "./ci/build/build-release.sh",
1919
"release:static": "./ci/build/build-static-release.sh",
2020
"release:github-draft": "./ci/build/release-github-draft.sh",
21+
"release:github-assets": "./ci/build/release-github-assets.sh",
2122
"test:static-release": "./ci/build/test-static-release.sh",
2223
"package": "./ci/build/build-packages.sh",
2324
"_____": "",

0 commit comments

Comments
 (0)