mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-18 04:56:45 +08:00
Compare commits
1 Commits
v1.1.5-202
...
v1.1.5-202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c940d6b15 |
95
.github/workflows/update-version-json.yml
vendored
95
.github/workflows/update-version-json.yml
vendored
@@ -73,68 +73,59 @@ jobs:
|
|||||||
curl -f -s "https://version.crossdesk.cn/version.json" -o version.json || echo "Failed to download, will create new one"
|
curl -f -s "https://version.crossdesk.cn/version.json" -o version.json || echo "Failed to download, will create new one"
|
||||||
|
|
||||||
- name: Generate or update version.json
|
- name: Generate or update version.json
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
TAG_NAME="${{ steps.version.outputs.TAG_NAME }}"
|
|
||||||
VERSION_ONLY="${{ steps.version.outputs.VERSION_ONLY }}"
|
|
||||||
BUILD_DATE_ISO="${{ steps.version.outputs.BUILD_DATE_ISO }}"
|
|
||||||
RELEASE_NAME_JSON="${{ steps.release_info.outputs.RELEASE_NAME }}"
|
|
||||||
RELEASE_BODY_JSON="${{ steps.release_info.outputs.RELEASE_BODY }}"
|
|
||||||
|
|
||||||
# Default downloads structure - use jq to build JSON safely
|
|
||||||
DEFAULT_DOWNLOADS=$(jq -n \
|
|
||||||
--arg tag "${TAG_NAME}" \
|
|
||||||
'{
|
|
||||||
"windows-x64": {
|
|
||||||
"url": ("https://downloads.crossdesk.cn/crossdesk-win-x64-" + $tag + ".exe"),
|
|
||||||
"filename": ("crossdesk-win-x64-" + $tag + ".exe")
|
|
||||||
},
|
|
||||||
"macos-x64": {
|
|
||||||
"url": ("https://downloads.crossdesk.cn/crossdesk-macos-x64-" + $tag + ".pkg"),
|
|
||||||
"filename": ("crossdesk-macos-x64-" + $tag + ".pkg")
|
|
||||||
},
|
|
||||||
"macos-arm64": {
|
|
||||||
"url": ("https://downloads.crossdesk.cn/crossdesk-macos-arm64-" + $tag + ".pkg"),
|
|
||||||
"filename": ("crossdesk-macos-arm64-" + $tag + ".pkg")
|
|
||||||
},
|
|
||||||
"linux-amd64": {
|
|
||||||
"url": ("https://downloads.crossdesk.cn/crossdesk-linux-amd64-" + $tag + ".deb"),
|
|
||||||
"filename": ("crossdesk-linux-amd64-" + $tag + ".deb")
|
|
||||||
},
|
|
||||||
"linux-arm64": {
|
|
||||||
"url": ("https://downloads.crossdesk.cn/crossdesk-linux-arm64-" + $tag + ".deb"),
|
|
||||||
"filename": ("crossdesk-linux-arm64-" + $tag + ".deb")
|
|
||||||
}
|
|
||||||
}')
|
|
||||||
|
|
||||||
# If version.json exists, try to preserve downloads section
|
# If version.json exists, try to preserve downloads section
|
||||||
if [ -f version.json ] && jq -e '.downloads' version.json > /dev/null 2>&1; then
|
if [ -f version.json ] && jq -e '.downloads' version.json > /dev/null 2>&1; then
|
||||||
EXISTING_DOWNLOADS=$(jq -c '.downloads' version.json)
|
EXISTING_DOWNLOADS=$(jq -c '.downloads' version.json)
|
||||||
if [ "$EXISTING_DOWNLOADS" != "null" ] && [ "$EXISTING_DOWNLOADS" != "{}" ]; then
|
if [ "$EXISTING_DOWNLOADS" != "null" ] && [ "$EXISTING_DOWNLOADS" != "{}" ]; then
|
||||||
DOWNLOADS="$EXISTING_DOWNLOADS"
|
DOWNLOADS_JSON="$EXISTING_DOWNLOADS"
|
||||||
else
|
else
|
||||||
DOWNLOADS="$DEFAULT_DOWNLOADS"
|
DOWNLOADS_JSON=""
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
DOWNLOADS="$DEFAULT_DOWNLOADS"
|
DOWNLOADS_JSON=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create version.json using jq for proper JSON formatting
|
# If downloads is empty, use default structure
|
||||||
jq -n \
|
if [ -z "$DOWNLOADS_JSON" ]; then
|
||||||
--arg version "$VERSION_ONLY" \
|
DOWNLOADS_JSON=$(cat << DOWNLOADS_EOF
|
||||||
--arg releaseDate "$BUILD_DATE_ISO" \
|
{
|
||||||
--argjson releaseName "$RELEASE_NAME_JSON" \
|
"windows-x64": {
|
||||||
--argjson releaseNotes "$RELEASE_BODY_JSON" \
|
"url": "https://downloads.crossdesk.cn/crossdesk-win-x64-${{ steps.version.outputs.TAG_NAME }}.exe",
|
||||||
--arg tagName "$TAG_NAME" \
|
"filename": "crossdesk-win-x64-${{ steps.version.outputs.TAG_NAME }}.exe"
|
||||||
--argjson downloads "$DOWNLOADS" \
|
},
|
||||||
'{
|
"macos-x64": {
|
||||||
version: $version,
|
"url": "https://downloads.crossdesk.cn/crossdesk-macos-x64-${{ steps.version.outputs.TAG_NAME }}.pkg",
|
||||||
releaseDate: $releaseDate,
|
"filename": "crossdesk-macos-x64-${{ steps.version.outputs.TAG_NAME }}.pkg"
|
||||||
releaseName: $releaseName,
|
},
|
||||||
releaseNotes: $releaseNotes,
|
"macos-arm64": {
|
||||||
tagName: $tagName,
|
"url": "https://downloads.crossdesk.cn/crossdesk-macos-arm64-${{ steps.version.outputs.TAG_NAME }}.pkg",
|
||||||
downloads: $downloads
|
"filename": "crossdesk-macos-arm64-${{ steps.version.outputs.TAG_NAME }}.pkg"
|
||||||
}' > version.json
|
},
|
||||||
|
"linux-amd64": {
|
||||||
|
"url": "https://downloads.crossdesk.cn/crossdesk-linux-amd64-${{ steps.version.outputs.TAG_NAME }}.deb",
|
||||||
|
"filename": "crossdesk-linux-amd64-${{ steps.version.outputs.TAG_NAME }}.deb"
|
||||||
|
},
|
||||||
|
"linux-arm64": {
|
||||||
|
"url": "https://downloads.crossdesk.cn/crossdesk-linux-arm64-${{ steps.version.outputs.TAG_NAME }}.deb",
|
||||||
|
"filename": "crossdesk-linux-arm64-${{ steps.version.outputs.TAG_NAME }}.deb"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DOWNLOADS_EOF
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate version.json using cat and heredoc
|
||||||
|
cat > version.json << EOF
|
||||||
|
{
|
||||||
|
"version": "${{ steps.version.outputs.VERSION_ONLY }}",
|
||||||
|
"releaseDate": "${{ steps.version.outputs.BUILD_DATE_ISO }}",
|
||||||
|
"releaseName": ${{ steps.release_info.outputs.RELEASE_NAME }},
|
||||||
|
"releaseNotes": ${{ steps.release_info.outputs.RELEASE_BODY }},
|
||||||
|
"tagName": "${{ steps.version.outputs.TAG_NAME }}",
|
||||||
|
"downloads": ${DOWNLOADS_JSON}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
cat version.json
|
cat version.json
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user