name: Publish Windows desktop release assets on: workflow_dispatch: inputs: run_id: description: "Completed windows.yml workflow run ID" required: true type: string release_tag: description: "Existing desktop GitHub Release tag (e.g. desktop-v0.10.118)" required: true type: string permissions: contents: write actions: read jobs: upload: runs-on: ubuntu-latest timeout-minutes: 15 env: GH_TOKEN: ${{ github.token }} RUN_ID: ${{ inputs.run_id }} RELEASE_TAG: ${{ inputs.release_tag }} steps: - name: Validate inputs and release run: | set -euo pipefail if ! [[ "$RUN_ID" =~ ^[0-9]+$ ]]; then echo "Invalid run_id: $RUN_ID" >&2 exit 1 fi if ! [[ "$RELEASE_TAG" =~ ^desktop-v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then echo "Invalid release_tag: $RELEASE_TAG" >&2 exit 1 fi VERSION="${RELEASE_TAG#desktop-v}" echo "VERSION=$VERSION" >> "$GITHUB_ENV" gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json tagName,url RUN_CONCLUSION="$(gh run view "$RUN_ID" --repo "$GITHUB_REPOSITORY" --json conclusion --jq '.conclusion')" if [[ "$RUN_CONCLUSION" != "success" ]]; then echo "Workflow run $RUN_ID conclusion is '$RUN_CONCLUSION', expected 'success'" >&2 exit 1 fi - name: Download and verify Windows x64 and arm64 artifacts run: | set -euo pipefail mkdir -p work/x64 work/arm64 gh run download "$RUN_ID" --repo "$GITHUB_REPOSITORY" -n "LinkShell-Windows-x64-unsigned" -D work/x64 gh run download "$RUN_ID" --repo "$GITHUB_REPOSITORY" -n "LinkShell-Windows-arm64-unsigned" -D work/arm64 for arch in x64 arm64; do echo "=== Verifying $arch ===" ( cd "work/$arch" ls -la sha256sum -c "LinkShell-Setup-${VERSION}-windows-${arch}.exe.sha256" sha256sum -c "LinkShell-${VERSION}-windows-${arch}.zip.sha256" ZIP="LinkShell-${VERSION}-windows-${arch}.zip" python3 - "$ZIP" "$VERSION" "$arch" <<'PY' import json, sys, zipfile zip_path, version, arch = sys.argv[1:4] with zipfile.ZipFile(zip_path) as zf: entries = {name.replace("\\", "/").lstrip("./"): name for name in zf.namelist()} standalone = json.loads(zf.read(entries["standalone.json"])) app_pkg = json.loads(zf.read(entries["resources/app/package.json"])) cli_pkg = json.loads(zf.read(entries["runtime/cli/package.json"])) print(f"standalone.json: version={standalone['version']} arch={standalone['arch']}") print(f"resources/app/package.json: version={app_pkg['version']}") print(f"runtime/cli/package.json: version={cli_pkg['version']}") assert standalone["version"] == version, standalone assert standalone["arch"] == arch, standalone assert app_pkg["version"] == version, app_pkg assert cli_pkg["version"] == version, cli_pkg assert "runtime/cli/dist/cli/src/index.js" in entries, "missing CLI entrypoint" assert "LinkShell.exe" in entries and "LinkShell.Screen.exe" in entries, "missing binaries" PY ) done - name: Upload verified assets to GitHub Release run: | set -euo pipefail gh release upload "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --clobber \ "work/x64/LinkShell-Setup-${VERSION}-windows-x64.exe" \ "work/x64/LinkShell-Setup-${VERSION}-windows-x64.exe.sha256" \ "work/x64/LinkShell-${VERSION}-windows-x64.zip" \ "work/x64/LinkShell-${VERSION}-windows-x64.zip.sha256" \ "work/arm64/LinkShell-Setup-${VERSION}-windows-arm64.exe" \ "work/arm64/LinkShell-Setup-${VERSION}-windows-arm64.exe.sha256" \ "work/arm64/LinkShell-${VERSION}-windows-arm64.zip" \ "work/arm64/LinkShell-${VERSION}-windows-arm64.zip.sha256" gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json tagName,assets --jq '{tagName, count: (.assets | length), assets: [.assets[] | {name, size}]}'