Skip to content

Commit 100b75f

Browse files
committed
fix: properly handle release URL between jobs
1 parent b48e176 commit 100b75f

File tree

1 file changed

+93
-11
lines changed

1 file changed

+93
-11
lines changed

.github/workflows/release.yml

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- 'v*'
66

77
jobs:
8-
release:
8+
build:
99
permissions:
1010
contents: write
1111
strategy:
@@ -21,6 +21,8 @@ jobs:
2121
- platform: 'windows-latest'
2222
args: ''
2323
runs-on: ${{ matrix.platform }}
24+
outputs:
25+
release_url: ${{ steps.build-app.outputs.release_url }}
2426
steps:
2527
- name: Checkout
2628
uses: actions/checkout@v4
@@ -55,22 +57,102 @@ jobs:
5557
uses: tauri-apps/tauri-action@v0
5658
env:
5759
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
59-
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
6060
with:
6161
tagName: ${{ github.ref_name }}
6262
releaseName: 'LitePost v${{ github.ref_name }}'
6363
releaseBody: 'See the assets to download this version and install.'
6464
releaseDraft: true
6565
prerelease: false
66-
includeUpdaterJson: true
67-
updaterJsonPreferNsis: true
6866
args: ${{ matrix.args }}
6967

70-
- name: Upload updater artifacts
71-
uses: actions/upload-artifact@v3
68+
create-update:
69+
needs: build
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
75+
- name: Install Node.js
76+
uses: actions/setup-node@v4
77+
with:
78+
node-version: 20
79+
80+
- name: Install pnpm
81+
uses: pnpm/action-setup@v2
82+
with:
83+
version: 8
84+
run_install: false
85+
86+
- name: Install Tauri CLI
87+
run: pnpm add -D @tauri-apps/cli
88+
89+
- name: Download all artifacts
90+
uses: actions/download-artifact@v3
91+
with:
92+
path: artifacts
93+
94+
- name: Generate signatures and updater JSON
95+
env:
96+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
97+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
run: |
100+
# Sign artifacts and collect signatures
101+
declare -A signatures
102+
for file in artifacts/build-*/; do
103+
if [ -f "$file" ]; then
104+
signature=$(pnpm tauri signer sign "$file")
105+
platform=$(basename "$file" | cut -d'-' -f2-)
106+
107+
case "$platform" in
108+
"macos-latest")
109+
if [[ "$file" == *"aarch64"* ]]; then
110+
signatures["darwin-aarch64"]="$signature"
111+
else
112+
signatures["darwin-x86_64"]="$signature"
113+
fi
114+
;;
115+
"ubuntu-22.04")
116+
signatures["linux-x86_64"]="$signature"
117+
;;
118+
"windows-latest")
119+
signatures["windows-x86_64"]="$signature"
120+
;;
121+
esac
122+
fi
123+
done
124+
125+
# Create latest.json with collected signatures
126+
echo '{
127+
"version": "${{ github.ref_name }}",
128+
"notes": "See the assets to download this version and install.",
129+
"pub_date": "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'",
130+
"platforms": {
131+
"darwin-x86_64": {
132+
"signature": "'${signatures["darwin-x86_64"]}'",
133+
"url": "https://github.com/LykosAI/LitePost/releases/download/${{ github.ref_name }}/LitePost_x64.app.tar.gz"
134+
},
135+
"darwin-aarch64": {
136+
"signature": "'${signatures["darwin-aarch64"]}'",
137+
"url": "https://github.com/LykosAI/LitePost/releases/download/${{ github.ref_name }}/LitePost_aarch64.app.tar.gz"
138+
},
139+
"linux-x86_64": {
140+
"signature": "'${signatures["linux-x86_64"]}'",
141+
"url": "https://github.com/LykosAI/LitePost/releases/download/${{ github.ref_name }}/litepost_0.1.0_amd64.AppImage"
142+
},
143+
"windows-x86_64": {
144+
"signature": "'${signatures["windows-x86_64"]}'",
145+
"url": "https://github.com/LykosAI/LitePost/releases/download/${{ github.ref_name }}/LitePost_0.1.0_x64-setup.exe"
146+
}
147+
}
148+
}' > latest.json
149+
150+
- name: Upload latest.json
151+
uses: actions/upload-release-asset@v1
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72154
with:
73-
name: updater-${{ matrix.platform }}
74-
path: |
75-
src-tauri/target/**/release/bundle/*/updater.json
76-
src-tauri/target/**/release/bundle/*/signature
155+
upload_url: ${{ needs.build.outputs.release_url }}
156+
asset_path: ./latest.json
157+
asset_name: latest.json
158+
asset_content_type: application/json

0 commit comments

Comments
 (0)