Skip to content

Commit 6998dda

Browse files
committed
Added update-automation.yaml
1 parent 2a382c7 commit 6998dda

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

.github/workflows/update-automation.yaml

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,79 @@ on:
66
workflow_dispatch:
77

88
jobs:
9-
run:
9+
update-automation:
10+
name: Run Automation Tasks
1011
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1114
steps:
12-
- run: echo "Scheduled job to run automation tasks"
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
submodules: true
20+
21+
- name: Get latest semver branch
22+
run: |
23+
git fetch origin
24+
LATEST_SEMVER=$(git branch -r | grep -E 'origin/[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/.*origin\///' | sort -V | tail -1)
25+
if [ -z "$LATEST_SEMVER" ]; then
26+
LATEST_SEMVER="main"
27+
echo "No semver branches found, using main"
28+
fi
29+
echo "LATEST_SEMVER=$LATEST_SEMVER" >> $GITHUB_ENV
30+
echo "Using branch: $LATEST_SEMVER"
31+
git checkout "$LATEST_SEMVER"
32+
git submodule update --init --recursive
33+
34+
- name: Check if update needed
35+
run: |
36+
cd third-party-src
37+
git fetch --tags
38+
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null | head -1)
39+
if [ -z "$CURRENT_TAG" ]; then
40+
echo "Error: Submodule is not on a tagged commit"
41+
exit 1
42+
fi
43+
cd ..
44+
45+
LATEST_TAG=$(curl -L \
46+
-H "Accept: application/vnd.github+json" \
47+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
48+
-H "X-GitHub-Api-Version: 2022-11-28" \
49+
https://api.github.com/repos/microsoft/vscode/releases/latest | jq -r '.tag_name')
50+
51+
echo "Current tag: $CURRENT_TAG"
52+
echo "Latest tag: $LATEST_TAG"
53+
54+
if [ "$CURRENT_TAG" = "$LATEST_TAG" ]; then
55+
echo "Submodule is up to date with latest VS Code release"
56+
exit 0
57+
else
58+
echo "Update needed: $CURRENT_TAG -> $LATEST_TAG"
59+
60+
# Create staging branch
61+
STAGING_BRANCH="staging-code-editor-$LATEST_TAG"
62+
echo "Creating staging branch: $STAGING_BRANCH"
63+
64+
git checkout -b "$STAGING_BRANCH"
65+
66+
# Update submodule to latest VS Code release
67+
echo "Updating submodule to $LATEST_TAG"
68+
cd third-party-src
69+
git fetch --tags
70+
git checkout "$LATEST_TAG"
71+
cd ..
72+
73+
# Configure git user and commit changes
74+
git config user.name "github-actions[bot]"
75+
git config user.email "github-actions[bot]@users.noreply.github.com"
76+
77+
git add third-party-src
78+
git commit -m "Update VS Code submodule to $LATEST_TAG"
79+
git push origin "$STAGING_BRANCH"
80+
81+
echo "✅ Created staging branch: $STAGING_BRANCH with VS Code $LATEST_TAG"
82+
fi
83+
84+

0 commit comments

Comments
 (0)