Skip to content

Commit 99bfd2c

Browse files
authored
Revert CI images in GitHub (#101)
* Revert "use versioned branch names for release images (#93)" This reverts commit a4842a7. * Revert "ci: push release images to branch instead of GitHub release (#90)" This reverts commit c937d27.
1 parent 4c4fd54 commit 99bfd2c

File tree

2 files changed

+25
-40
lines changed

2 files changed

+25
-40
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,29 @@ jobs:
130130
path: build/
131131

132132
- name: generate manifest
133+
env:
134+
RELEASE_URL: https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}
133135
run: |
134136
VERSION=$(cat userspace/root/VERSION)
135-
BRANCH="v${VERSION}"
136137
echo "VERSION=$VERSION" >> $GITHUB_ENV
137-
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
138-
BASE_URL="https://raw.githubusercontent.com/${{ github.repository }}/${BRANCH}"
139-
BASE_URL=$BASE_URL python3 tools/build/package_ota.py
138+
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}"
139+
RELEASE_URL=$RELEASE_URL python3 tools/build/package_ota.py
140140
141-
- name: push images to version branch
141+
- name: create release
142142
env:
143143
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144144
run: |
145-
cd build/ota
146-
git init
147-
git checkout --orphan "$BRANCH"
148-
git add .
149-
git -c user.name="github-actions" -c user.email="[email protected]" \
150-
commit -m "release images for $BRANCH"
151-
git remote add origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
152-
git push --force origin "$BRANCH"
145+
TAG="v${VERSION}"
146+
147+
# Delete existing release if it exists
148+
gh release delete "$TAG" --yes 2>/dev/null || true
149+
git tag -d "$TAG" 2>/dev/null || true
150+
git push origin ":refs/tags/$TAG" 2>/dev/null || true
151+
152+
# Create release with all images and manifest
153+
gh release create "$TAG" \
154+
--title "vamOS $TAG" \
155+
--target "${{ github.sha }}" \
156+
--notes "Automated release from commit ${{ github.sha }}" \
157+
build/ota/*.img \
158+
build/ota/manifest.json

tools/build/package_ota.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
OTA_OUTPUT_DIR = OUTPUT_DIR / "ota"
1313

1414
SECTOR_SIZE = 4096
15-
CHUNK_SIZE = 52_428_800 # 50 MB - must be under raw.githubusercontent.com's 100 MB limit
1615

17-
BASE_URL = os.environ.get("BASE_URL", "https://raw.githubusercontent.com/commaai/vamOS/release-images")
16+
RELEASE_URL = os.environ.get("RELEASE_URL", "https://github.com/commaai/vamos/releases/download/untagged")
1817

1918
GPT = namedtuple('GPT', ['lun', 'name', 'path', 'start_sector', 'num_sectors', 'has_ab', 'full_check'])
2019
GPTS = [
@@ -74,30 +73,14 @@ def process_file(entry):
7473
sha256.update(b'\x00' * ((SECTOR_SIZE - (size % SECTOR_SIZE)) % SECTOR_SIZE))
7574
ondevice_hash = sha256.hexdigest()
7675

77-
base_name = f"{entry.name}-{hash_raw}.img"
78-
79-
# Write file(s) to output directory, splitting into chunks if needed
80-
chunks = None
81-
if size > CHUNK_SIZE:
82-
chunks = []
83-
chunk_idx = 0
84-
with open(entry.path, 'rb') as f:
85-
while True:
86-
data = f.read(CHUNK_SIZE)
87-
if not data:
88-
break
89-
chunk_name = f"{base_name}.{chunk_idx:02d}"
90-
(OTA_OUTPUT_DIR / chunk_name).write_bytes(data)
91-
chunks.append({"url": f"{BASE_URL}/{chunk_name}", "size": len(data)})
92-
print(f" chunk {chunk_idx}: {chunk_name} ({len(data)} bytes)")
93-
chunk_idx += 1
94-
else:
95-
print(f" copying to {base_name}")
96-
shutil.copy(entry.path, OTA_OUTPUT_DIR / base_name)
76+
# Copy to output directory
77+
out_fn = OTA_OUTPUT_DIR / f"{entry.name}-{hash_raw}.img"
78+
print(f" copying to {out_fn.name}")
79+
shutil.copy(entry.path, out_fn)
9780

9881
ret = {
9982
"name": entry.name,
100-
"url": f"{BASE_URL}/{base_name}",
83+
"url": f"{RELEASE_URL}/{out_fn.name}",
10184
"hash": hash,
10285
"hash_raw": hash_raw,
10386
"size": size,
@@ -107,10 +90,6 @@ def process_file(entry):
10790
"ondevice_hash": ondevice_hash,
10891
}
10992

110-
if chunks:
111-
ret["url"] = ""
112-
ret["chunks"] = chunks
113-
11493
if isinstance(entry, GPT):
11594
ret["gpt"] = {
11695
"lun": entry.lun,

0 commit comments

Comments
 (0)