Merge pull request #36 from Jasonzhu1207/fix/release-upload-assets

fix(release): upload assets after packaging
This commit is contained in:
Jason
2026-04-28 12:12:51 +08:00
committed by GitHub

View File

@@ -13,8 +13,42 @@ env:
ELECTRON_BUILDER_BINARIES_MIRROR: https://github.com/electron-userland/electron-builder-binaries/releases/download/ ELECTRON_BUILDER_BINARIES_MIRROR: https://github.com/electron-userland/electron-builder-binaries/releases/download/
jobs: jobs:
prepare-release:
runs-on: ubuntu-latest
steps:
- name: Check out git repository
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Ensure GitHub release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
source .github/scripts/release-utils.sh
TAG="$GITHUB_REF_NAME"
REPO="$GITHUB_REPOSITORY"
VERSION="${TAG#v}"
prerelease_args=()
if [[ "$VERSION" == *-* ]]; then
prerelease_args+=(--prerelease)
fi
if gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1; then
retry_cmd 5 3 gh release edit "$TAG" --repo "$REPO" --draft=false "${prerelease_args[@]}"
else
retry_cmd 5 3 gh release create "$TAG" --repo "$REPO" --title "$TAG" --notes "Release $TAG" --target "$GITHUB_SHA" "${prerelease_args[@]}"
fi
wait_for_release_id "$REPO" "$TAG" 12 2 >/dev/null
release-mac-arm64: release-mac-arm64:
runs-on: macos-14 runs-on: macos-14
needs: prepare-release
steps: steps:
- name: Check out git repository - name: Check out git repository
@@ -43,19 +77,29 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish macOS arm64 (unsigned DMG + ZIP) - name: Package and Upload macOS arm64 (unsigned DMG + ZIP)
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: "false" CSC_IDENTITY_AUTO_DISCOVERY: "false"
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
source .github/scripts/release-utils.sh
export ELECTRON_BUILDER_BINARIES_MIRROR="https://github.com/electron-userland/electron-builder-binaries/releases/download/" export ELECTRON_BUILDER_BINARIES_MIRROR="https://github.com/electron-userland/electron-builder-binaries/releases/download/"
echo "Using ELECTRON_BUILDER_BINARIES_MIRROR=$ELECTRON_BUILDER_BINARIES_MIRROR" echo "Using ELECTRON_BUILDER_BINARIES_MIRROR=$ELECTRON_BUILDER_BINARIES_MIRROR"
if ! npx electron-builder --mac dmg zip --arm64 --publish always '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}'; then if ! npx electron-builder --mac dmg zip --arm64 --publish never '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}'; then
echo "::warning::DMG packaging failed (hdiutil instability on runner). Retrying with ZIP only." echo "::warning::DMG packaging failed (hdiutil instability on runner). Retrying with ZIP only."
npx electron-builder --mac zip --arm64 --publish always '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' npx electron-builder --mac zip --arm64 --publish never '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}'
fi fi
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
upload_release_assets_with_retry "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" "${assets[@]}"
- name: Inject minimumVersion into latest yml - name: Inject minimumVersion into latest yml
env: env:
@@ -81,6 +125,7 @@ jobs:
release-linux: release-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: prepare-release
steps: steps:
- name: Check out git repository - name: Check out git repository
@@ -114,11 +159,23 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish Linux - name: Package and Upload Linux
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --linux --publish always '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' set -euo pipefail
source .github/scripts/release-utils.sh
npx electron-builder --linux --publish never '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}'
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
upload_release_assets_with_retry "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" "${assets[@]}"
- name: Inject minimumVersion into latest yml - name: Inject minimumVersion into latest yml
env: env:
@@ -139,6 +196,7 @@ jobs:
release: release:
runs-on: windows-latest runs-on: windows-latest
needs: prepare-release
steps: steps:
- name: Check out git repository - name: Check out git repository
@@ -167,11 +225,23 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish - name: Package and Upload Windows x64
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --win nsis --x64 --publish always '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' '--config.artifactName=${productName}-${version}-x64-Setup.${ext}' set -euo pipefail
source .github/scripts/release-utils.sh
npx electron-builder --win nsis --x64 --publish never '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' '--config.artifactName=${productName}-${version}-x64-Setup.${ext}'
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
upload_release_assets_with_retry "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" "${assets[@]}"
- name: Inject minimumVersion into latest yml - name: Inject minimumVersion into latest yml
env: env:
@@ -192,6 +262,7 @@ jobs:
release-windows-arm64: release-windows-arm64:
runs-on: windows-latest runs-on: windows-latest
needs: prepare-release
steps: steps:
- name: Check out git repository - name: Check out git repository
@@ -220,11 +291,23 @@ jobs:
npx tsc npx tsc
npx vite build npx vite build
- name: Package and Publish Windows arm64 - name: Package and Upload Windows arm64
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: | run: |
npx electron-builder --win nsis --arm64 --publish always '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' '--config.publish.channel=latest-arm64' '--config.artifactName=${productName}-${version}-arm64-Setup.${ext}' set -euo pipefail
source .github/scripts/release-utils.sh
npx electron-builder --win nsis --arm64 --publish never '--config.publish.owner=${{ github.repository_owner }}' '--config.publish.repo=${{ github.event.repository.name }}' '--config.publish.channel=latest-arm64' '--config.artifactName=${productName}-${version}-arm64-Setup.${ext}'
assets=()
while IFS= read -r file; do
assets+=("$file")
done < <(find release -maxdepth 1 -type f | sort)
if [ "${#assets[@]}" -eq 0 ]; then
echo "No release files found in ./release"
exit 1
fi
upload_release_assets_with_retry "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" "${assets[@]}"
- name: Inject minimumVersion into latest yml - name: Inject minimumVersion into latest yml
env: env: