Skip to content

Commit 48dfd83

Browse files
Refactor sync script location and CI workflow
- Move sync script from scripts/ to .github/ - Add comprehensive usage documentation as comments in sync-from-release.sh - Remove commit message validation from CI workflow - Remove scripts/README.md - Update CI workflow to reference new script location Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
1 parent 55b1247 commit 48dfd83

File tree

3 files changed

+28
-62
lines changed

3 files changed

+28
-62
lines changed

scripts/sync-from-release.sh renamed to .github/sync-from-release.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
#!/bin/bash
22

3+
# Sync script for downloading and extracting content from TinyGo releases
4+
#
5+
# Usage:
6+
# ./sync-from-release.sh <tinygo-version> <source-path> <target-folder>
7+
#
8+
# Parameters:
9+
# <tinygo-version> - TinyGo version (e.g., v0.39.0)
10+
# <source-path> - Source path within TinyGo package (e.g., src/device)
11+
# <target-folder> - Target directory for extracted content (e.g., device)
12+
#
13+
# Examples:
14+
# ./sync-from-release.sh v0.39.0 src/device device
15+
# ./sync-from-release.sh v0.39.0 src/machine machine
16+
#
17+
# How it works:
18+
# 1. Downloads the specified TinyGo release from GitHub (linux-amd64 version)
19+
# 2. Extracts the requested source path from the tarball
20+
# 3. Copies the content to the target folder
21+
# 4. Cleans up temporary files
22+
#
23+
# Notes:
24+
# - Uses linux-amd64 version (content is identical across platforms)
25+
# - Requires wget and tar utilities
26+
# - Includes retry logic (3 attempts with 30s timeout)
27+
328
set -e
429

530
if [ "$#" -ne 3 ]; then

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,10 @@ jobs:
2121
with:
2222
fetch-depth: 0
2323

24-
- name: Validate commit message format
25-
if: github.event_name == 'push'
26-
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"
37-
3824
- name: Sync device content from TinyGo release
3925
run: |
40-
chmod +x scripts/sync-from-release.sh
41-
./scripts/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device-temp
26+
chmod +x .github/sync-from-release.sh
27+
./.github/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device-temp
4228
4329
- name: Compare synced content with repository
4430
run: |
@@ -47,7 +33,7 @@ jobs:
4733
if ! diff -r device/ device-temp/; then
4834
echo ""
4935
echo "Error: device/ directory does not match TinyGo ${{ env.TINYGO_VERSION }} official content"
50-
echo "Please run: ./scripts/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device"
36+
echo "Please run: ./.github/sync-from-release.sh ${{ env.TINYGO_VERSION }} src/device device"
5137
exit 1
5238
fi
5339
@@ -59,7 +45,6 @@ jobs:
5945
echo "================================"
6046
echo "✓ All validations passed!"
6147
echo "================================"
62-
echo "- Commit message format: valid"
6348
echo "- Device content sync: verified"
6449
echo "- TinyGo version: ${{ env.TINYGO_VERSION }}"
6550
echo "================================"

scripts/README.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)