| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f21884c commit 599d64c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,8 +24,7 @@ Any file or directory in this subdirectory should be documented here. | |||
| 24 | 24 | - It will upload them to the draft release. | |
| 25 | 25 | 6. Run some basic sanity tests on one of the released packages. | |
| 26 | 26 | - Especially make sure the terminal works fine. | |
| 27 | - 7. Make sure the github release tag is the commit with the artifacts. This is a bug in | ||
| 28 | - `hub` where uploading assets in step 5 will break the tag. | ||
| 27 | + 7. Make sure the github release tag is the commit with the artifacts. | ||
| 29 | 28 | 8. Publish the release and merge the PR. | |
| 30 | 29 | 1. CI will automatically grab the artifacts and then: | |
| 31 | 30 | 1. Publish the NPM package from `npm-package`. | |
@@ -106,10 +105,10 @@ You can disable minification by setting `MINIFY=`. | |||
| 106 | 105 | - [./ci/build/code-server.service](./build/code-server.service) | |
| 107 | 106 | - systemd user service packaged into the `.deb` and `.rpm`. | |
| 108 | 107 | - [./ci/build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`) | |
| 109 | - - Uses [hub](https://github.com/github/hub) to create a draft release with a template description. | ||
| 108 | + - Uses [gh](https://github.com/cli/cli) to create a draft release with a template description. | ||
| 110 | 109 | - [./ci/build/release-github-assets.sh](./build/release-github-assets.sh) (`yarn release:github-assets`) | |
| 111 | 110 | - Downloads the release-package artifacts for the current commit from CI. | |
| 112 | - - Uses [hub](https://github.com/github/hub) to upload the artifacts to the release | ||
| 111 | + - Uses [gh](https://github.com/cli/cli) to upload the artifacts to the release | ||
| 113 | 112 | specified in `package.json`. | |
| 114 | 113 | - [./ci/build/npm-postinstall.sh](./build/npm-postinstall.sh) | |
| 115 | 114 | - Post install script for the npm package. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ main() { | |||
| 15 | 15 | for i in "${!assets[@]}"; do | |
| 16 | 16 | assets[$i]="--attach=${assets[$i]}" | |
| 17 | 17 | done | |
| 18 | - EDITOR=true hub release edit --draft "${assets[@]}" "v$VERSION" | ||
| 18 | + EDITOR=true gh release upload "v$VERSION" "${assets[@]}" | ||
| 19 | 19 | } | |
| 20 | 20 | ||
| 21 | 21 | main "$@" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,10 +7,10 @@ main() { | |||
| 7 | 7 | cd "$(dirname "$0")/../.." | |
| 8 | 8 | source ./ci/lib.sh | |
| 9 | 9 | ||
| 10 | - hub release create \ | ||
| 11 | - --file - \ | ||
| 12 | - -t "$(git rev-parse HEAD)" \ | ||
| 13 | - --draft "v$VERSION" <<EOF | ||
| 10 | + gh release create "v$VERSION" \ | ||
| 11 | + --notes-file - \ | ||
| 12 | + --target "$(git rev-parse HEAD)" \ | ||
| 13 | + --draft <<EOF | ||
| 14 | 14 | v$VERSION | |
| 15 | 15 | ||
| 16 | 16 | VS Code v$(vscode_version) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | #!/usr/bin/env bash | |
| 2 | 2 | # Description: This is a script to make the release process easier | |
| 3 | 3 | # Run it with `yarn release:prep` and it will do the following: | |
| 4 | - # 1. Check that you have a $GITHUB_TOKEN set and hub installed | ||
| 4 | + # 1. Check that you have gh installed and that you're signed in | ||
| 5 | 5 | # 2. Update the version of code-server (package.json, docs, etc.) | |
| 6 | 6 | # 3. Update the code coverage badge in the README | |
| 7 | 7 | # 4. Open a draft PR using the release_template.md and view in browser | |
@@ -19,19 +19,11 @@ main() { | |||
| 19 | 19 | ||
| 20 | 20 | cd "$(dirname "$0")/../.." | |
| 21 | 21 | ||
| 22 | - # Check that $GITHUB_TOKEN is set | ||
| 23 | - if [[ -z ${GITHUB_TOKEN-} ]]; then | ||
| 24 | - echo "We couldn't find an environment variable under GITHUB_TOKEN." | ||
| 25 | - echo "This is needed for our scripts that use hub." | ||
| 26 | - echo -e "See docs regarding GITHUB_TOKEN here under 'GitHub OAuth authentication': https://hub.github.com/hub.1.html" | ||
| 27 | - exit | ||
| 28 | - fi | ||
| 29 | - | ||
| 30 | - # Check that hub is installed | ||
| 31 | - if ! command -v hub &>/dev/null; then | ||
| 32 | - echo "hub could not be found." | ||
| 22 | + # Check that gh is installed | ||
| 23 | + if ! command -v gh &>/dev/null; then | ||
| 24 | + echo "gh could not be found." | ||
| 33 | 25 | echo "We use this with the release-github-draft.sh and release-github-assets.sh scripts." | |
| 34 | - echo -e "See docs here: https://github.com/github/hub#installation" | ||
| 26 | + echo -e "See docs here: https://github.com/cli/cli#installation" | ||
| 35 | 27 | exit | |
| 36 | 28 | fi | |
| 37 | 29 | ||
@@ -68,6 +60,14 @@ main() { | |||
| 68 | 60 | exit | |
| 69 | 61 | fi | |
| 70 | 62 | ||
| 63 | + # Check that gh is authenticated | ||
| 64 | + if ! gh auth status -h github.com &>/dev/null; then | ||
| 65 | + echo "gh isn't authenticated to github.com." | ||
| 66 | + echo "This is needed for our scripts that use gh." | ||
| 67 | + echo -e "See docs regarding authentication: https://cli.github.com/manual/gh_auth_login" | ||
| 68 | + exit | ||
| 69 | + fi | ||
| 70 | + | ||
| 71 | 71 | # Note: we need to set upstream as well or the gh pr create step will fail | |
| 72 | 72 | # See: https://github.com/cli/cli/issues/575 | |
| 73 | 73 | CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,24 +49,20 @@ arch() { | |||
| 49 | 49 | esac | |
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | - curl() { | ||
| 53 | - command curl -H "Authorization: token $GITHUB_TOKEN" "$@" | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | 52 | # Grabs the most recent ci.yaml github workflow run that was successful and triggered from the same commit being pushd. | |
| 57 | 53 | # This will contain the artifacts we want. | |
| 58 | 54 | # https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs | |
| 59 | 55 | get_artifacts_url() { | |
| 60 | 56 | local artifacts_url | |
| 61 | - local workflow_runs_url="https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=pull_request" | ||
| 57 | + local workflow_runs_url="repos/:owner/:repo/actions/workflows/ci.yaml/runs?status=success&event=pull_request" | ||
| 62 | 58 | # For releases, we look for run based on the branch name v$code_server_version | |
| 63 | 59 | # example: v3.9.3 | |
| 64 | 60 | local version_branch="v$VERSION" | |
| 65 | - artifacts_url=$(curl -fsSL "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1) | ||
| 61 | + artifacts_url=$(gh api "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1) | ||
| 66 | 62 | if [[ -z "$artifacts_url" ]]; then | |
| 67 | 63 | echo >&2 "ERROR: artifacts_url came back empty" | |
| 68 | 64 | echo >&2 "We looked for a successful run triggered by a pull_request with for code-server version: $code_server_version and a branch named $version_branch" | |
| 69 | - echo >&2 "URL used for curl call: $workflow_runs_url" | ||
| 65 | + echo >&2 "URL used for gh API call: $workflow_runs_url" | ||
| 70 | 66 | exit 1 | |
| 71 | 67 | fi | |
| 72 | 68 | ||
@@ -77,7 +73,7 @@ get_artifacts_url() { | |||
| 77 | 73 | # https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts | |
| 78 | 74 | get_artifact_url() { | |
| 79 | 75 | local artifact_name="$1" | |
| 80 | - curl -fsSL "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1 | ||
| 76 | + gh api "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1 | ||
| 81 | 77 | } | |
| 82 | 78 | ||
| 83 | 79 | # Uses the above two functions to download a artifact into a directory. | |
@@ -88,7 +84,7 @@ download_artifact() { | |||
| 88 | 84 | local tmp_file | |
| 89 | 85 | tmp_file="$(mktemp)" | |
| 90 | 86 | ||
| 91 | - curl -fsSL "$(get_artifact_url "$artifact_name")" >"$tmp_file" | ||
| 87 | + gh api "$(get_artifact_url "$artifact_name")" >"$tmp_file" | ||
| 92 | 88 | unzip -q -o "$tmp_file" -d "$dst" | |
| 93 | 89 | rm "$tmp_file" | |
| 94 | 90 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments