Skip to content

Commit b2d547c

Browse files
Update CI to check against latest TinyGo version
- Remove hardcoded TINYGO_VERSION from env - Add step to fetch latest TinyGo release from GitHub API - Update all references to use dynamically fetched version - CI now always validates against the latest TinyGo release Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
1 parent b09806f commit b2d547c

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

.github/workflows/validate-device-sync.yml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
branches:
99
- device
1010

11-
env:
12-
TINYGO_VERSION: v0.39.0
13-
1411
jobs:
1512
validate:
1613
runs-on: ubuntu-latest
@@ -21,45 +18,37 @@ jobs:
2118
with:
2219
fetch-depth: 0
2320

24-
- name: Validate commit message format
25-
if: github.event_name == 'push'
21+
- name: Get latest TinyGo version
22+
id: tinygo-version
2623
run: |
27-
COMMIT_MSG=$(git log -1 --pretty=%B)
28-
echo "Commit message: $COMMIT_MSG"
29-
30-
if ! echo "$COMMIT_MSG" | grep -qE '^\[SYNC\] Update device to TinyGo v[0-9]+\.[0-9]+\.[0-9]+'; then
31-
echo "Error: Commit message must follow format: [SYNC] Update device to TinyGo <version>"
32-
echo "Example: [SYNC] Update device to TinyGo v0.39.0"
33-
exit 1
34-
fi
35-
36-
echo "✓ Commit message format is valid"
24+
LATEST_VERSION=$(curl -s https://api.github.com/repos/tinygo-org/tinygo/releases/latest | jq -r .tag_name)
25+
echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
26+
echo "Latest TinyGo version: $LATEST_VERSION"
3727
3828
- name: Sync device content from TinyGo release
3929
run: |
4030
chmod +x .github/scripts/sync-from-release.sh
41-
./.github/scripts/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device-temp
31+
./.github/scripts/sync-from-release.sh ${{ steps.tinygo-version.outputs.version }} src/device device-temp
4232
4333
- name: Compare synced content with repository
4434
run: |
4535
echo "Comparing device-temp/ with device/..."
4636
4737
if ! diff -r device/ device-temp/; then
4838
echo ""
49-
echo "Error: device/ directory does not match TinyGo ${{ env.TINYGO_VERSION }} official content"
50-
echo "Please run: ./.github/scripts/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device"
39+
echo "Error: device/ directory does not match TinyGo ${{ steps.tinygo-version.outputs.version }} official content"
40+
echo "Please run: ./.github/scripts/sync-from-release.sh ${{ steps.tinygo-version.outputs.version }} src/device device"
5141
exit 1
5242
fi
5343
54-
echo "✓ Device content matches TinyGo ${{ env.TINYGO_VERSION }} release"
44+
echo "✓ Device content matches TinyGo ${{ steps.tinygo-version.outputs.version }} release"
5545
5646
- name: Validation Summary
5747
if: success()
5848
run: |
5949
echo "================================"
6050
echo "✓ All validations passed!"
6151
echo "================================"
62-
echo "- Commit message format: valid"
6352
echo "- Device content sync: verified"
64-
echo "- TinyGo version: ${{ env.TINYGO_VERSION }}"
53+
echo "- TinyGo version: ${{ steps.tinygo-version.outputs.version }}"
6554
echo "================================"

0 commit comments

Comments
 (0)