Skip to content

Commit 2447b26

Browse files
committed
ci: publish zexi electron builds to releases
1 parent 7ce0463 commit 2447b26

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

.github/workflows/zexi-electron.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@ on:
1919
- prod
2020
- beta
2121
- dev
22+
release_tag:
23+
description: "Optional GitHub Release tag, for example desktop-v1"
24+
required: false
25+
type: string
26+
release_name:
27+
description: "Optional GitHub Release name"
28+
required: false
29+
type: string
2230

2331
concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.ref || 'head' }}
2432

2533
permissions:
26-
contents: read
34+
contents: write
2735

2836
jobs:
2937
build-electron:
@@ -125,3 +133,35 @@ jobs:
125133
packages/desktop-electron/dist/*
126134
!packages/desktop-electron/dist/*unpacked
127135
!packages/desktop-electron/dist/mac-arm64
136+
137+
publish-release:
138+
needs: build-electron
139+
if: github.event_name == 'workflow_dispatch' && inputs.release_tag != ''
140+
runs-on: ubuntu-latest
141+
steps:
142+
- uses: actions/download-artifact@v4
143+
with:
144+
path: release-artifacts
145+
146+
- name: Create or update release
147+
env:
148+
GH_TOKEN: ${{ github.token }}
149+
RELEASE_TAG: ${{ inputs.release_tag }}
150+
RELEASE_NAME: ${{ inputs.release_name || inputs.release_tag }}
151+
run: |
152+
gh release view "$RELEASE_TAG" >/dev/null 2>&1 || gh release create "$RELEASE_TAG" --title "$RELEASE_NAME" --notes ""
153+
154+
- name: Upload release assets
155+
env:
156+
GH_TOKEN: ${{ github.token }}
157+
RELEASE_TAG: ${{ inputs.release_tag }}
158+
run: |
159+
find release-artifacts -type f \
160+
\( \
161+
-name '*.dmg' -o \
162+
-name '*.zip' -o \
163+
-name '*.exe' -o \
164+
-name 'latest*.yml' -o \
165+
-name '*.blockmap' \
166+
\) \
167+
-print0 | xargs -0 gh release upload "$RELEASE_TAG" --clobber

0 commit comments

Comments
 (0)