-
Notifications
You must be signed in to change notification settings - Fork 324
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
base: main
Are you sure you want to change the base?
Changes from all commits
3818aa7
27c9007
81632a6
b70f42d
9095f2b
0d8e3ef
afb41d5
c38ed55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: vscode-generate-changelog | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to generate the changlog for' | ||
required: true | ||
default: 'main' | ||
type: string | ||
|
||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
- name: Generate changelog | ||
env: | ||
DEVX_SERVICE_GH_TOKEN: ${{ secrets.DEVX_SERVICE_GH_TOKEN }} | ||
GH_REPO: "sourcegraph/cody" | ||
CHANGELOG_CATEGORY_ACCEPTLIST: "added,changed,fixed" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we left this as empty, it will group all categories in the PRs? |
||
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) | ||
export RELEASE_LATEST_RELEASE=$(git rev-parse $PREV_TAG) | ||
|
||
# Get current release commit | ||
export RELEASE_LATEST_COMMIT=$(git rev-parse HEAD) | ||
|
||
# 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="vscode/CHANGELOG.md" \ | ||
--output.changelog.marker='{/* CHANGELOG_START */}' \ | ||
--releaseregistry.version=$EXT_VERSION | ||
|
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,64 @@ jobs: | |
asset_path: ./vscode/dist/cody.vsix | ||
asset_name: cody-vscode-${{ env.EXT_VERSION }}.vsix | ||
asset_content_type: application/zip | ||
- name: Generate changelog | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove this step now right, and have the generate changelog manually be run |
||
env: | ||
DEVX_SERVICE_GH_TOKEN: ${{ secrets.DEVX_SERVICE_GH_TOKEN }} | ||
GH_REPO: "sourcegraph/cody" | ||
CHANGELOG_CATEGORY_ACCEPTLIST: "added,changed,fixed" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Why are we selecting that one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, for me this returns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
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 | ||
Comment on lines
+96
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you provide a sample of what maybe instead of appending the entire Example, this is what the current first 20 lines of
depending on what
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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have this type in the release registry already? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
- name: Determine version numbers | ||
run: | | ||
tag="${{ env.EXT_VERSION }}" | ||
|
@@ -112,7 +170,7 @@ jobs: | |
echo "SKIP_BRANCH_CREATION=true" >> $GITHUB_ENV | ||
exit 0 | ||
fi | ||
|
||
# Check if label exists | ||
if gh label list | grep -q "backport ${{ env.NEXT_RELEASE_BRANCH }}"; then | ||
echo "Label backport ${{ env.NEXT_RELEASE_BRANCH }} already exists" | ||
|
@@ -131,7 +189,7 @@ jobs: | |
repo: context.repo.repo, | ||
name: `${nextBackportLabel}`, | ||
description: `Backport to ${nextReleaseBranch} branch` | ||
}) | ||
}) | ||
- name: Create and push next release branch | ||
if: ${{ !env.SKIP_BRANCH_CREATION }} | ||
run: | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.