From 58491f317f230c2aa85da9e3095c4626c00093fa Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 7 May 2026 10:42:07 -0800 Subject: [PATCH] Add workflow for updating VS Code For now it is manually triggered. --- .github/workflows/update.yaml | 36 +++++++++++++++++++++++++++++++++++ ci/build/update-vscode.sh | 17 ++++++++++------- 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/update.yaml diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml new file mode 100644 index 000000000..02aecb3fa --- /dev/null +++ b/.github/workflows/update.yaml @@ -0,0 +1,36 @@ +name: Update code-server + +on: + workflow_dispatch: + inputs: + version: + type: string + required: true + +jobs: + update: + runs-on: ubuntu-latest + env: + VERSION: ${{ inputs.version }} + GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + with: + node-version-file: .node-version + + - run: ./ci/build/update-vscode.sh + + - name: Open PR + run: | + git config --global user.name cdrci + git config --global user.email opensource@coder.com + git checkout -b update/${{ env.VERSION }} + git add . + git commit -m "Update VS Code to ${{ env.VERSION }}" + git push -u origin $(git branch --show) + gh pr create --repo coder/code-server-aur \ + --title "Update VS Code to ${{ env.VERSION }}" \ + --body-file .cache/checklist \ + --draft diff --git a/ci/build/update-vscode.sh b/ci/build/update-vscode.sh index 0888a1630..e2c3b2bff 100755 --- a/ci/build/update-vscode.sh +++ b/ci/build/update-vscode.sh @@ -17,10 +17,10 @@ function remove_patches() { function update_vscode() { pushd lib/vscode - if ! git checkout "$VERSION" ; then - echo "$VERSION does not exist locally, fetching..." + if ! git checkout "$target_vscode_version" ; then + echo "$target_vscode_version does not exist locally, fetching..." git fetch --all --prune - git checkout "$VERSION" + git checkout "$target_vscode_version" fi popd } @@ -110,12 +110,12 @@ function run() { function add_changelog() { local file=CHANGELOG.md - if grep "Code $VERSION" "$file" ; then - echo "Changelog for $VERSION already exists" + if grep "Code $target_vscode_version" "$file" ; then + echo "Changelog for $target_vscode_version already exists" else # TODO: This is not exactly robust. In particular, it needs to handle if # there is already a "changed" section. - sed -i.bak "s/## Unreleased/## Unreleased\n\nCode v$VERSION\n\n### Changed\n\n- Update to Code $VERSION/" "$file" + sed -i.bak "s/## Unreleased/## Unreleased\n\nCode v$target_vscode_version\n\n### Changed\n\n- Update to Code $target_vscode_version/" "$file" fi } @@ -127,6 +127,9 @@ function main() { local target_node_version target_node_version=$(grep target lib/vscode/remote/.npmrc | awk -F= '{print $2}' | tr -d '"') + local target_vscode_version + target_vscode_version="${VERSION#v}" + declare -a steps # Removing patches only needs to be done locally; in CI we start from a fresh # clone each time. @@ -135,7 +138,7 @@ function main() { fi steps+=( - "Update VS Code to $VERSION" "update_vscode" + "Update VS Code to $target_vscode_version" "update_vscode" "Refresh VS Code patches" "refresh_patches" "Set Node version to $target_node_version" "update_node" "Update CSP webview hash" "update_csp"