Skip to content

Commit 0f68b85

Browse files
author
linyuan.yang
committed
release-app
1 parent 2430b60 commit 0f68b85

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

‎.github/workflows/release-app.yml‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,46 @@ jobs:
7878
echo "RELEASE_NOTES_EOF"
7979
} >> "$GITHUB_OUTPUT"
8080
81-
release-desktop:
81+
prepare-release:
8282
needs: check
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Create or refresh GitHub Release
86+
env:
87+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
REPO: ${{ github.repository }}
89+
TAG: ${{ needs.check.outputs.tag }}
90+
VERSION: ${{ needs.check.outputs.version }}
91+
RELEASE_NOTES: ${{ needs.check.outputs.notes }}
92+
shell: bash
93+
run: |
94+
set -euo pipefail
95+
if gh release view "$TAG" -R "$REPO" >/dev/null 2>&1; then
96+
gh release edit "$TAG" -R "$REPO" \
97+
--title "sbot v${VERSION}" \
98+
--notes "$RELEASE_NOTES"
99+
else
100+
gh release create "$TAG" -R "$REPO" \
101+
--target "$GITHUB_SHA" \
102+
--title "sbot v${VERSION}" \
103+
--notes "$RELEASE_NOTES"
104+
fi
105+
106+
gh api "/repos/$REPO/releases/tags/$TAG" --jq '.assets[] | "\(.id)\t\(.name)"' |
107+
while IFS=$'\t' read -r id name; do
108+
case "$name" in
109+
"sbot_${VERSION}_android.apk"|sbot-vscode-*.vsix)
110+
continue
111+
;;
112+
"latest.json"|"latest-app.json"|"sbot.app.tar.gz"|"sbot.app.tar.gz.sig"|sbot_*.app.tar.gz|sbot_*.app.tar.gz.sig|sbot_${VERSION}_*)
113+
echo "delete stale release asset: $name"
114+
gh api -X DELETE "/repos/$REPO/releases/assets/$id" >/dev/null
115+
;;
116+
esac
117+
done
118+
119+
release-desktop:
120+
needs: [check, prepare-release]
83121
strategy:
84122
fail-fast: false
85123
matrix:

0 commit comments

Comments
 (0)