Skip to content

Commit d6c1b47

Browse files
committed
ci(release): upload versioned assets only, auto-update zipUrl
1 parent 7f86c5d commit d6c1b47

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,30 @@ jobs:
140140
gh release delete "$VER" --yes 2>/dev/null || true
141141
RELEASE=$(ls zips/*Release*.zip | head -1)
142142
DEBUG=$(ls zips/*Debug*.zip | head -1)
143-
cp "$RELEASE" zips/TEESimulator-RS-Release.zip
144-
cp "$DEBUG" zips/TEESimulator-RS-Debug.zip
145143
gh release create "$VER" \
146144
--title "$VER" \
147145
--latest \
148146
--notes-file /tmp/notes.md \
149147
"$RELEASE" \
150-
"$DEBUG" \
151-
zips/TEESimulator-RS-Release.zip \
152-
zips/TEESimulator-RS-Debug.zip
148+
"$DEBUG"
153149
env:
154150
VER: ${{ steps.ver.outputs.version }}
155151
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156152

157-
- name: Bump update.json versionCode
153+
- name: Bump update.json
158154
run: |
159155
COUNT=$(git rev-list HEAD --count)
160-
CURRENT=$(jq -r '.versionCode' module/update.json)
161-
if [ "$COUNT" != "$CURRENT" ]; then
162-
jq ".versionCode = $COUNT" module/update.json > /tmp/update.json
163-
mv /tmp/update.json module/update.json
164-
git config user.name "github-actions[bot]"
165-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
166-
git add module/update.json
167-
git commit -m "chore(release): bump versionCode to $COUNT [skip ci]"
156+
RELEASE_NAME=$(basename zips/*Release*.zip)
157+
ZIP_URL="https://github.com/${{ github.repository }}/releases/download/${VER}/${RELEASE_NAME}"
158+
jq ".versionCode = $COUNT | .zipUrl = \"$ZIP_URL\"" module/update.json > /tmp/update.json
159+
mv /tmp/update.json module/update.json
160+
git config user.name "github-actions[bot]"
161+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
162+
git add module/update.json
163+
git diff --cached --quiet || {
164+
git commit -m "chore(release): bump update.json to $VER [skip ci]"
168165
git push origin HEAD:main
169-
fi
166+
}
167+
env:
168+
VER: ${{ steps.ver.outputs.version }}
169+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)