Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: changelog generator + releaseregistry registration #6243

Closed
wants to merge 12 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/vscode-stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,61 @@ jobs:
asset_path: ./vscode/dist/cody.vsix
asset_name: cody-vscode-${{ env.EXT_VERSION }}.vsix
asset_content_type: application/zip
- name: Generate changelog
Chickensoupwithrice marked this conversation as resolved.
Show resolved Hide resolved
env:
DEVX_SERVICE_GH_TOKEN: ${{ secrets.DEVX_SERVICE_GH_TOKEN }}
GH_REPO: "sourcegraph/cody"
CHANGELOG_CATEGORY_ACCEPTLIST: "added,changed,fixed"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we leave this blank, will the tooling accept and group all categories?

CHANGELOG_SKIP_NO_CHANGELOG: "true"
CHANGELOG_COMPACT: "true"
EXT_VERSION: ${{ env.EXT_VERSION }}
run: |
# Get previous tag's commit
PREV_TAG=$( git tag --sort=-v:refname | grep '^vscode-v' | head -n 2 | tail -n 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this assume we've already registered our new release version? i.e.

vscode-v1.2.3
vscode-v1.2.2
vscode-v1.2.1
This would return 'vscode-v1.2.2'

Why are we selecting that one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, for me this returns vscode-v1.46.0 which is currently the latest release, which is what we're trying to get. Once the releaseregistry is hooked up and has a bit of data, we can switch to using that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The list, without taking the second element exclusively, on my machine is:
image

export RELEASE_LATEST_RELEASE=$(git rev-parse $PREV_TAG)

# Get current release commit
export RELEASE_LATEST_COMMIT=$GITHUB_SHA
Chickensoupwithrice marked this conversation as resolved.
Show resolved Hide resolved

# Download and run changelog generator
tagName=$(gh release -R sourcegraph/devx-service list --exclude-drafts --exclude-pre-releases -L 1 --json tagName -q '.[] | .tagName')
gh release -R sourcegraph/devx-service download ${tagName} --pattern changelog
chmod +x changelog

./changelog write \
--output-file="raw-changelog.md" \
--releaseregistry.version=$EXT_VERSION

cat vscode/CHANGELOG.md >> raw-changelog.md
mv raw-changelog.md vscode/CHANGELOG.md

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog generator doesn't do "prepend" to file for existing changelogs. We're doing that part by hand in the shell file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you provide a sample of what raw-changelog.md will look like?

maybe instead of appending the entire vscode/changelog.md into raw-changelog, we can find a spot within vscode/changelog.md and append under it

Example, this is what the current first 20 lines of vscode/changelog.md looks like:

# Changelog

This is a log of all notable changes to Cody for VS Code.

## Unreleased

### Added

### Fixed

### Changed

### Uncategorized

## 1.50.0

### Added
- Webviews: add new CTA for Sourcegraph Teams  [pull/6245](https://github.com/sourcegraph/cody/pull/6245)
- "Explain command" in context (existing conversation)  [pull/5986](https://github.com/sourcegraph/cody/pull/5986)

depending on what raw-changelog.md looks like, we could just append it right under ### uncategorized using

awk '/### Uncategorized/{if (!found) {print; system("cat raw_changelog.md"); found=1; next}} 1' vscode/CHANGELOG.md > temp_changelog.md

# Replace original file with new content
mv temp_changelog.md vscode/CHANGELOG.md

maybe we can pair on this to be clear!

git checkout -b release/vscode-v$EXT_VERSION
git add vscode/CHANGELOG.md
git commit -m "Automated release and changelog for VS code Cody"
git push -u origin release/vscode-v$EXT_VERSION
gh pr create \
--title "VS Code: Release v$EXT_VERSION" \
--body "Automated release and changelog for VS code Cody" \
--base main --head release/vscode-v$EXT_VERSION
Chickensoupwithrice marked this conversation as resolved.
Show resolved Hide resolved
- name: Register on Releaseregistry
env:
EXT_VERSION: ${{ env.EXT_VERSION }}
RELEASE_REGISTRY_TOKEN: ${{ secrets.RELEASE_REGISTRY_TOKEN }}
run: |
echo "Registering internal cody-vscode $EXT_VERSION release on release registry"
body=$(wget --content-on-error -O- --header="Content-Type: application/json" --header="Authorization: ${RELEASE_REGISTRY_TOKEN}" --post-data '{
"name": "cody-vscode",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this type in the release registry already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it's new!

"version": "'${EXT_VERSION}'",
"git_sha": "'${GITHUB_SHA}'"
}' "https://releaseregistry.sourcegraph.com/v1/releases")
exit_code=$?

if [ $exit_code != 0 ]; then
echo "❌ Failed to create release in release registry, got:"
echo "--- raw body ---"
echo $body
echo "--- raw body ---"
exit $exit_code
else
echo "Release created, see:"
echo $body
fi
Loading