Skip to content

Commit 58491f3

Browse files
committed
Add workflow for updating VS Code
For now it is manually triggered.
1 parent 9527b78 commit 58491f3

2 files changed

Lines changed: 46 additions & 7 deletions

File tree

.github/workflows/update.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update code-server
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
type: string
8+
required: true
9+
10+
jobs:
11+
update:
12+
runs-on: ubuntu-latest
13+
env:
14+
VERSION: ${{ inputs.version }}
15+
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
16+
17+
steps:
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
19+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
20+
with:
21+
node-version-file: .node-version
22+
23+
- run: ./ci/build/update-vscode.sh
24+
25+
- name: Open PR
26+
run: |
27+
git config --global user.name cdrci
28+
git config --global user.email opensource@coder.com
29+
git checkout -b update/${{ env.VERSION }}
30+
git add .
31+
git commit -m "Update VS Code to ${{ env.VERSION }}"
32+
git push -u origin $(git branch --show)
33+
gh pr create --repo coder/code-server-aur \
34+
--title "Update VS Code to ${{ env.VERSION }}" \
35+
--body-file .cache/checklist \
36+
--draft

ci/build/update-vscode.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ function remove_patches() {
1717

1818
function update_vscode() {
1919
pushd lib/vscode
20-
if ! git checkout "$VERSION" ; then
21-
echo "$VERSION does not exist locally, fetching..."
20+
if ! git checkout "$target_vscode_version" ; then
21+
echo "$target_vscode_version does not exist locally, fetching..."
2222
git fetch --all --prune
23-
git checkout "$VERSION"
23+
git checkout "$target_vscode_version"
2424
fi
2525
popd
2626
}
@@ -110,12 +110,12 @@ function run() {
110110

111111
function add_changelog() {
112112
local file=CHANGELOG.md
113-
if grep "Code $VERSION" "$file" ; then
114-
echo "Changelog for $VERSION already exists"
113+
if grep "Code $target_vscode_version" "$file" ; then
114+
echo "Changelog for $target_vscode_version already exists"
115115
else
116116
# TODO: This is not exactly robust. In particular, it needs to handle if
117117
# there is already a "changed" section.
118-
sed -i.bak "s/## Unreleased/## Unreleased\n\nCode v$VERSION\n\n### Changed\n\n- Update to Code $VERSION/" "$file"
118+
sed -i.bak "s/## Unreleased/## Unreleased\n\nCode v$target_vscode_version\n\n### Changed\n\n- Update to Code $target_vscode_version/" "$file"
119119
fi
120120
}
121121

@@ -127,6 +127,9 @@ function main() {
127127
local target_node_version
128128
target_node_version=$(grep target lib/vscode/remote/.npmrc | awk -F= '{print $2}' | tr -d '"')
129129

130+
local target_vscode_version
131+
target_vscode_version="${VERSION#v}"
132+
130133
declare -a steps
131134
# Removing patches only needs to be done locally; in CI we start from a fresh
132135
# clone each time.
@@ -135,7 +138,7 @@ function main() {
135138
fi
136139

137140
steps+=(
138-
"Update VS Code to $VERSION" "update_vscode"
141+
"Update VS Code to $target_vscode_version" "update_vscode"
139142
"Refresh VS Code patches" "refresh_patches"
140143
"Set Node version to $target_node_version" "update_node"
141144
"Update CSP webview hash" "update_csp"

0 commit comments

Comments
 (0)