|
21 | 21 | git checkout -b "feature/desktop-${DESKTOP_VERSION}" |
22 | 22 | - name: Update params.yaml |
23 | 23 | run: | |
24 | | - echo "TODO $DESKTOP_VERSION" > config/_default/params.yaml |
| 24 | + MSI_URL=$(jq -r '[.[] | select(.name | endswith(".msi"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 25 | + MSI_DIGEST=$(jq -r '[.[] | select(.name | endswith(".msi"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 26 | + EXE_URL=$(jq -r '[.[] | select(.name | endswith(".exe"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 27 | + EXE_DIGEST=$(jq -r '[.[] | select(.name | endswith(".exe"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 28 | + DMG_X64_URL=$(jq -r '[.[] | select(.name | endswith("-x64.dmg"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 29 | + DMG_X64_DIGEST=$(jq -r '[.[] | select(.name | endswith("-x64.dmg"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 30 | + DMG_ARM64_URL=$(jq -r '[.[] | select(.name | endswith("-arm64.dmg"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 31 | + DMG_ARM64_DIGEST=$(jq -r '[.[] | select(.name | endswith("-arm64.dmg"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 32 | + APPIMAGE_AARCH64_URL=$(jq -r '[.[] | select(.name | endswith("-aarch64.AppImage"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 33 | + APPIMAGE_AARCH64_DIGEST=$(jq -r '[.[] | select(.name | endswith("-aarch64.AppImage"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 34 | + APPIMAGE_X64_URL=$(jq -r '[.[] | select(.name | endswith("-x86_64.AppImage"))][0].browser_download_url // "null"' <<< "$ASSETS_JSON") |
| 35 | + APPIMAGE_X64_DIGEST=$(jq -r '[.[] | select(.name | endswith("-x86_64.AppImage"))][0].digest // "null"' <<< "$ASSETS_JSON") |
| 36 | +
|
| 37 | + UPDATED_ASSETS=0 |
| 38 | +
|
| 39 | + update_release() { |
| 40 | + local key="$1" |
| 41 | + local url="$2" |
| 42 | + local digest="$3" |
| 43 | + local filename_expr="${4:-'(env(RELEASE_URL) | split(\"/\") | .[-1])'}" |
| 44 | +
|
| 45 | + if [ "$url" = "null" ] || [ -z "$url" ]; then |
| 46 | + return |
| 47 | + fi |
| 48 | +
|
| 49 | + UPDATED_ASSETS=1 |
| 50 | + RELEASE_URL="$url" RELEASE_DIGEST="${digest#sha256:}" yq -i " |
| 51 | + .releases.${key}.version = env(DESKTOP_VERSION) | |
| 52 | + .releases.${key}.filename = ${filename_expr} | |
| 53 | + .releases.${key}.downloadUrl = env(RELEASE_URL) | |
| 54 | + .releases.${key}.signatureUrl = (env(RELEASE_URL) + \".asc\") | |
| 55 | + .releases.${key}.checksum = env(RELEASE_DIGEST) |
| 56 | + " config/_default/params.yaml |
| 57 | + } |
| 58 | +
|
| 59 | + update_release "exe" "$EXE_URL" "$EXE_DIGEST" |
| 60 | + update_release "msi" "$MSI_URL" "$MSI_DIGEST" |
| 61 | + update_release "dmg" "$DMG_X64_URL" "$DMG_X64_DIGEST" '("Cryptomator-" + env(DESKTOP_VERSION) + ".dmg")' |
| 62 | + update_release '"dmg-arm64"' "$DMG_ARM64_URL" "$DMG_ARM64_DIGEST" |
| 63 | + update_release "appimage" "$APPIMAGE_X64_URL" "$APPIMAGE_X64_DIGEST" |
| 64 | + update_release '"appimage-aarch64"' "$APPIMAGE_AARCH64_URL" "$APPIMAGE_AARCH64_DIGEST" |
| 65 | +
|
| 66 | + if [ "$UPDATED_ASSETS" -eq 0 ]; then |
| 67 | + echo "No supported desktop assets found in release payload" |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + env: |
| 71 | + ASSETS_JSON: ${{ toJson(github.event.client_payload.release.assets ) }} |
25 | 72 | - name: Commit and push |
26 | 73 | run: | |
27 | 74 | git config user.name "cryptobot" |
|
0 commit comments