mirror of
https://github.com/cdr/code-server.git
synced 2026-05-08 20:43:12 +02:00
Check for updates on a schedule
This commit is contained in:
parent
bd41dca064
commit
62a552d896
2 changed files with 48 additions and 12 deletions
52
.github/workflows/update.yaml
vendored
52
.github/workflows/update.yaml
vendored
|
|
@ -6,31 +6,67 @@ on:
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
schedule:
|
||||||
|
- cron: "23 * * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ inputs.version }}
|
TAG: ${{ inputs.version }}
|
||||||
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Fetch latest tag
|
||||||
|
if: env.TAG == ''
|
||||||
|
run: |
|
||||||
|
tag=$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/microsoft/vscode/releases/latest)
|
||||||
|
tag="${tag#https://github.com/microsoft/vscode/releases/tag/}"
|
||||||
|
echo "TAG=$tag" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Remove leading v from tag
|
||||||
|
run: |
|
||||||
|
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||||
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
||||||
with:
|
with:
|
||||||
node-version-file: .node-version
|
submodules: true
|
||||||
|
|
||||||
|
- name: Check current version
|
||||||
|
id: check
|
||||||
|
run: |
|
||||||
|
commit="$(git -C lib/vscode rev-parse HEAD)"
|
||||||
|
if [[ $(git -C lib/vscode ls-remote --tags | grep "$commit") == */"$VERSION" ]] ; then
|
||||||
|
echo "$VERSION update has already been merged into $(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
echo done=true >> $GITHUB_OUTPUT
|
||||||
|
elif git ls-remote --exit-code --heads origin "update/$VERSION" ; then
|
||||||
|
echo "There is already a PR for updating to $VERSION"
|
||||||
|
echo done=true >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "$VERSION update has not started yet"
|
||||||
|
echo done=false >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
|
||||||
|
if: steps.check.outputs.done == 'false'
|
||||||
|
with:
|
||||||
|
packages: quilt
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
- run: ./ci/build/update-vscode.sh
|
- run: ./ci/build/update-vscode.sh
|
||||||
|
if: steps.check.outputs.done == 'false'
|
||||||
|
|
||||||
- name: Open PR
|
- name: Open PR
|
||||||
|
if: steps.check.outputs.done == 'false'
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name cdrci
|
git config --global user.name cdrci
|
||||||
git config --global user.email opensource@coder.com
|
git config --global user.email opensource@coder.com
|
||||||
git checkout -b update/${{ env.VERSION }}
|
git checkout -b "update/$VERSION"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update VS Code to ${{ env.VERSION }}"
|
git commit -m "Update VS Code to $VERSION"
|
||||||
git push -u origin $(git branch --show)
|
git push -u origin "$(git branch --show)"
|
||||||
gh pr create --repo coder/code-server-aur \
|
gh pr create \
|
||||||
--title "Update VS Code to ${{ env.VERSION }}" \
|
--repo coder/code-server \
|
||||||
|
--title "Update VS Code to $VERSION" \
|
||||||
--body-file .cache/checklist \
|
--body-file .cache/checklist \
|
||||||
--draft
|
--draft
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ function refresh_patches() {
|
||||||
function update_node() {
|
function update_node() {
|
||||||
local node_version
|
local node_version
|
||||||
node_version=$(cat .node-version)
|
node_version=$(cat .node-version)
|
||||||
if [[ $node_version == $target_node_version ]] ; then
|
if [[ $node_version == "$target_node_version" ]] ; then
|
||||||
echo "$node_version already matches $target_node_version"
|
echo "$node_version already matches $target_node_version"
|
||||||
else
|
else
|
||||||
echo "Updating from $node_version to $target_node_version..."
|
echo "Updating from $node_version to $target_node_version..."
|
||||||
|
|
@ -52,11 +52,11 @@ function update_node() {
|
||||||
|
|
||||||
function get-webview-script-hash() {
|
function get-webview-script-hash() {
|
||||||
local html
|
local html
|
||||||
html=$(<$1)
|
html=$(<"$1")
|
||||||
local start_tag='<script async type="module">'
|
local start_tag='<script async type="module">'
|
||||||
local end_tag="</script>"
|
local end_tag="</script>"
|
||||||
html=${html##*$start_tag}
|
html=${html##*"$start_tag"}
|
||||||
html=${html%%$end_tag*}
|
html=${html%%"$end_tag"*}
|
||||||
echo -n "$html" | openssl sha256 -binary | openssl base64
|
echo -n "$html" | openssl sha256 -binary | openssl base64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue