-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add details to VS Code Extension updates (#339)
* chore: fix sorting order of vscode.extensions * docs: update tool version issue text * chore: remove cmake.options.statusBarVisibility Let's leave this one up to the user * chore: add more details to dependency updates * chore: fix missing 'shell' property * ci: fix unbound variable access * chore: fix heredoc streaming * chore: fix variable type mismatch * chore: simplify output * chore: remove invalid output * chore: fix multi-line output * chore: add GitHub release details * chore: add GH_TOKEN for gh cli * chore: fix comment layout * chore: prepare formatting for json output * chore: include releasenotes for all versions between latests and current * chore: better layout * chore: last formatting fix * docs: small description change * refactor: escape '`' in shell code * chore: output list of updated dependencies * chore: remove accidentally pushed submodule * Update release-please-config.json Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: make chore releasable and refactor PR naming --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
cb909f8
commit b24a2b5
Showing
10 changed files
with
134 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: "Update VS Code Extensions" | ||
description: "Updates version-pinned VS Code Extensions in JSON files" | ||
|
||
inputs: | ||
input-file: | ||
description: "Input file in JSON format containing a list of version pinned VS Code Extensions under `customizations.vscode.extensions`" | ||
required: true | ||
|
||
outputs: | ||
updated-dependencies: | ||
description: "JSON array with the names of the updated dependencies" | ||
value: ${{ steps.update-extensions.outputs.updated-dependencies }} | ||
markdown-summary: | ||
description: "Markdown summary of update result" | ||
value: ${{ steps.update-extensions.outputs.markdown-summary }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- run: echo "$GITHUB_ACTION_PATH" >> "$GITHUB_PATH" | ||
shell: bash | ||
env: | ||
GITHUB_ACTION_PATH: ${{ github.action_path }} | ||
- run: | | ||
sudo apt-get update | ||
sudo apt-get install --no-install-recommends -y jq | ||
sudo npm install -g @vscode/vsce | ||
shell: bash | ||
- run: | | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
echo "markdown-summary<<${EOF}" >> "${GITHUB_OUTPUT}" | ||
echo "$(update-vscode-extensions.sh ${INPUT_FILE})" >> "${GITHUB_OUTPUT}" | ||
echo "${EOF}" >> "${GITHUB_OUTPUT}" | ||
echo "updated-dependencies=$(cat updated-extensions.json)" >> "${GITHUB_OUTPUT}" | ||
rm updated-extensions.json | ||
id: update-extensions | ||
shell: bash | ||
env: | ||
INPUT_FILE: ${{ inputs.input-file }} | ||
GH_TOKEN: ${{ github.token }} |
52 changes: 52 additions & 0 deletions
52
.github/actions/update-vscode-extensions/update-vscode-extensions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -Eeuo pipefail | ||
|
||
FILE=${1:?} | ||
JSON=$(cat $FILE) | ||
EXTENSIONS= | ||
UPDATE_DETAILS_MARKDOWN= | ||
UPDATED_EXTENSIONS_JSON="[]" | ||
|
||
get_github_releasenotes() { | ||
local GITHUB_URL=${1:?} | ||
local CURRENT_RELEASE=${2:?} | ||
|
||
gh release list --exclude-drafts --exclude-pre-releases -R $GITHUB_URL --json name,tagName --jq '.[]' | while read -r RELEASE; | ||
do | ||
NAME=$(echo "$RELEASE" | jq -r '.name') | ||
TAG=$(echo "$RELEASE" | jq -r '.tagName') | ||
|
||
if [[ $NAME == *$CURRENT_RELEASE* || $TAG == v$CURRENT_RELEASE ]]; | ||
then | ||
break; | ||
fi | ||
|
||
printf "%s\n\n" "$(gh release view --json body --jq '.body' -R $GITHUB_URL $TAG)" | ||
done | ||
} | ||
|
||
for EXTENSION in $(echo $JSON | jq -r '.[].customizations.vscode.extensions | flatten[]'); do | ||
NAME="${EXTENSION%%@*}" | ||
CURRENT_VERSION="${EXTENSION#*@}" | ||
|
||
LATEST_NON_PRERELEASE_VERSION_JSON=$(vsce show --json $NAME | jq '[ .versions[] | select(.properties) | select(any(.properties[].key; contains("Microsoft.VisualStudio.Code.PreRelease")) | not) ][0]') | ||
LATEST_NON_PRERELEASE_VERSION=$(echo $LATEST_NON_PRERELEASE_VERSION_JSON | jq -r '.version') | ||
|
||
if [[ $CURRENT_VERSION != $LATEST_NON_PRERELEASE_VERSION ]]; | ||
then | ||
GITHUB_URL=$(echo $LATEST_NON_PRERELEASE_VERSION_JSON | jq -r '.properties | map(select(.key == "Microsoft.VisualStudio.Services.Links.GitHub"))[] | .value') | ||
|
||
RELEASE_DETAILS=$(get_github_releasenotes $GITHUB_URL $CURRENT_VERSION) | ||
UPDATE_DETAILS_MARKDOWN=$(printf "Updates \`%s\` from %s to %s\n<details>\n<summary>Release notes</summary>\n<blockquote>\n\n%s\n</blockquote>\n</details>\n\n%s" $NAME $CURRENT_VERSION $LATEST_NON_PRERELEASE_VERSION "$RELEASE_DETAILS" "$UPDATE_DETAILS_MARKDOWN") | ||
UPDATED_EXTENSIONS_JSON=$(echo $UPDATED_EXTENSIONS_JSON | jq -c '. += ["'$NAME'"]') | ||
fi | ||
|
||
EXTENSIONS="\"$NAME@$LATEST_NON_PRERELEASE_VERSION\",$EXTENSIONS" | ||
done | ||
|
||
EXTENSIONS=$(echo "[${EXTENSIONS::-1}]" | jq 'sort_by(. | ascii_downcase)') | ||
echo $JSON | jq '.[].customizations.vscode.extensions = $extensions' --argjson extensions "$EXTENSIONS" > $FILE | ||
|
||
echo "$UPDATE_DETAILS_MARKDOWN" | ||
echo "$UPDATED_EXTENSIONS_JSON" > updated-extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", | ||
"changelog-sections": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes", | ||
"hidden": false | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Chores", | ||
"hidden": false | ||
} | ||
], | ||
"include-component-in-tag": false, | ||
"plugins": ["sentence-case"], | ||
"packages": { | ||
".": { | ||
"release-type": "simple", | ||
"package-name": "amp-devcontainer" | ||
"package-name": "amp-devcontainer", | ||
"release-type": "simple" | ||
} | ||
}, | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" | ||
"plugins": ["sentence-case"] | ||
} |