diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..3941e705f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +name: Draft release + +on: + workflow_dispatch: + +permissions: + contents: write # For creating releases. + discussions: write # For creating a discussion. + +# Cancel in-progress runs for pull requests when developers push +# additional changes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + draft: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Download artifacts + uses: dawidd6/action-download-artifact@v2 + id: download + with: + branch: ${{ github.ref }} + workflow: ci.yaml + workflow_conclusion: completed + check_artifacts: true + name: release-packages + path: ./release-packages + + - uses: softprops/action-gh-release@v1 + with: + draft: true + discussion_category_name: "📣 Announcements" + files: ./release-packages/* diff --git a/ci/build/release-github-assets.sh b/ci/build/release-github-assets.sh deleted file mode 100755 index 6395adcb7..000000000 --- a/ci/build/release-github-assets.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Downloads the release artifacts from CI for the current -# commit and then uploads them to the release with the version -# in package.json. -# You will need $GITHUB_TOKEN set. - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - source ./ci/steps/steps-lib.sh - - # NOTE@jsjoeio - only needed if we use the download_artifact - # because we talk to the GitHub API. - # Needed to use GitHub API - if ! is_env_var_set "GITHUB_TOKEN"; then - echo "GITHUB_TOKEN is not set. Cannot download npm release-packages without GitHub credentials." - exit 1 - fi - - download_artifact release-packages ./release-packages - local assets=(./release-packages/code-server*"$VERSION"*{.tar.gz,.deb,.rpm}) - - EDITOR=true gh release upload "v$VERSION" "${assets[@]}" --clobber -} - -main "$@" diff --git a/ci/build/release-github-draft.sh b/ci/build/release-github-draft.sh deleted file mode 100755 index 69073e4dc..000000000 --- a/ci/build/release-github-draft.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Creates a draft release with the template for the version in package.json - -main() { - cd "$(dirname "$0")/../.." - source ./ci/lib.sh - - gh release create "v$VERSION" \ - --notes-file - \ - --target "$(git rev-parse HEAD)" \ - --draft << EOF -v$VERSION - -VS Code v$(vscode_version) - -Upgrading is as easy as installing the new version over the old one. code-server -maintains all user data in \`~/.local/share/code-server\` so that it is preserved in between -installations. - -## New Features - -⭐ Summarize new features here with references to issues - - - item - -## Bug Fixes - -⭐ Summarize bug fixes here with references to issues - - - item - -## Documentation - -⭐ Summarize doc changes here with references to issues - - - item - -## Development - -⭐ Summarize development/testing changes here with references to issues - - - item - -Cheers! 🍻 -EOF -} - -main "$@" diff --git a/ci/lib.sh b/ci/lib.sh index cef865234..789ccb001 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -44,47 +44,6 @@ arch() { echo "$cpu" } -# Grabs the most recent ci.yaml github workflow run that was triggered from the -# pull request of the release branch for this version (regardless of whether -# that run succeeded or failed). The release branch name must be in semver -# format with a v prepended. -# This will contain the artifacts we want. -# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs -get_artifacts_url() { - local artifacts_url - local version_branch="release/v$VERSION" - local workflow_runs_url="repos/:owner/:repo/actions/workflows/ci.yaml/runs?event=pull_request&branch=$version_branch" - artifacts_url=$(gh api "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1) - if [[ -z "$artifacts_url" ]]; then - echo >&2 "ERROR: artifacts_url came back empty" - echo >&2 "We looked for a successful run triggered by a pull_request with for code-server version: $VERSION and a branch named $version_branch" - echo >&2 "URL used for gh API call: $workflow_runs_url" - exit 1 - fi - - echo "$artifacts_url" -} - -# Grabs the artifact's download url. -# https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts -get_artifact_url() { - local artifact_name="$1" - gh api "$(get_artifacts_url)" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .archive_download_url" | head -n 1 -} - -# Uses the above two functions to download a artifact into a directory. -download_artifact() { - local artifact_name="$1" - local dst="$2" - - local tmp_file - tmp_file="$(mktemp)" - - gh api "$(get_artifact_url "$artifact_name")" > "$tmp_file" - unzip -q -o "$tmp_file" -d "$dst" - rm "$tmp_file" -} - rsync() { command rsync -a --del "$@" } diff --git a/docs/MAINTAINING.md b/docs/MAINTAINING.md index 83249f4a1..ce8e164c6 100644 --- a/docs/MAINTAINING.md +++ b/docs/MAINTAINING.md @@ -137,43 +137,19 @@ changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS). ## Releases -With each release, we rotate the role of release manager to ensure every -maintainer goes through the process. This helps us keep documentation up-to-date -and encourages us to continually review and improve the flow. - -If you're the current release manager, follow these steps: - -1. Create a [release issue](../.github/ISSUE_TEMPLATE/release.md) -1. Fill out checklist -1. Publish the release -1. After release is published, close release milestone - ### Publishing a release 1. Create a new branch called `release/v0.0.0` (replace 0s with actual version aka v4.5.0) 1. If you don't do this, the `npm-brew` GitHub workflow will fail. It looks for the release artifacts under the branch pattern. -1. Run `yarn release:prep` and type in the new version (e.g., `3.8.1`) -1. GitHub Actions will generate the `npm-package`, `release-packages` and - `release-images` artifacts. You do not have to wait for this step to complete - before proceeding. -1. Run `yarn release:github-draft` to create a GitHub draft release from the - template with the updated version. Make sure to update the `CHANGELOG.md`. +1. Run `yarn release:prep ` (e.g., `yarn release:prep 3.8.1`) 1. Bump chart version in `Chart.yaml`. -1. Summarize the major changes in the release notes and link to the relevant - issues. -1. Change the @ to target the version branch. Example: `v3.9.0 @ Target: release/v3.9.0` -1. Wait for the `npm-package`, `release-packages` and `release-images` artifacts - to build. -1. Run `yarn release:github-assets` to download the `release-packages` artifact. - They will upload them to the draft release. -1. Run some basic sanity tests on one of the released packages (pay special - attention to making sure the terminal works). -1. Publish the release and merge the PR. CI will automatically grab the +1. Summarize the major changes in the `CHANGELOG.md` +1. Download CI artifacts and make sure code-server works locally. +1. Merge PR and wait for CI build on `main` to finish. +1. Go to GitHub Actions > Draft release > Run workflow off `main`. CI will automatically upload the artifacts to the release. +1. Add the release notes from the `CHANGELOG.md` and publish release. CI will automatically grab the artifacts, publish the NPM package from `npm-package`, and publish the Docker Hub image from `release-images`. -1. Update the AUR package. Instructions for updating the AUR package are at - [coder/code-server-aur](https://github.com/coder/code-server-aur). -1. Wait for the npm package to be published. #### AUR diff --git a/package.json b/package.json index 566c60b9e..4e07c91f0 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,6 @@ "build:vscode": "./ci/build/build-vscode.sh", "release": "./ci/build/build-release.sh", "release:standalone": "./ci/build/build-standalone-release.sh", - "release:github-draft": "./ci/build/release-github-draft.sh", - "release:github-assets": "./ci/build/release-github-assets.sh", "release:prep": "./ci/build/release-prep.sh", "test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh", "test:e2e:proxy": "USE_PROXY=1 ./ci/dev/test-e2e.sh",