|
8 | 8 | pull_request: |
9 | 9 | branches: [n_api, master] |
10 | 10 | workflow_dispatch: # Allow manual triggering |
| 11 | + inputs: |
| 12 | + release_tag: |
| 13 | + description: 'Release tag to upload prebuilds to (e.g., v5.0.0)' |
| 14 | + required: false |
| 15 | + type: string |
11 | 16 |
|
12 | 17 | jobs: |
13 | 18 | prebuild-node: |
|
86 | 91 | Write-Host "prebuilds directory not found" |
87 | 92 | } |
88 | 93 |
|
| 94 | + - name: Debug GitHub ref |
| 95 | + run: | |
| 96 | + echo "GitHub ref: ${{ github.ref }}" |
| 97 | + echo "Is tag: ${{ startsWith(github.ref, 'refs/tags/') }}" |
| 98 | + echo "GitHub event name: ${{ github.event_name }}" |
| 99 | +
|
89 | 100 | - name: Upload to GitHub Release |
90 | 101 | if: startsWith(github.ref, 'refs/tags/') |
91 | | - run: npx prebuild --upload-all |
| 102 | + run: | |
| 103 | + echo "Uploading prebuilds to GitHub release..." |
| 104 | + echo "Current tag: ${{ github.ref_name }}" |
| 105 | + npx prebuild --upload-all --tag-prefix v |
| 106 | + env: |
| 107 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 108 | + |
| 109 | + # Alternative: Upload to a specific release when running manually |
| 110 | + - name: Upload to Specific Release (Manual) |
| 111 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '' |
| 112 | + run: | |
| 113 | + echo "Uploading prebuilds to release: ${{ github.event.inputs.release_tag }}" |
| 114 | + npx prebuild --upload-all --tag-prefix v --target ${{ github.event.inputs.release_tag }} |
92 | 115 | env: |
93 | 116 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
94 | 117 |
|
@@ -164,9 +187,27 @@ jobs: |
164 | 187 | Write-Host "prebuilds directory not found" |
165 | 188 | } |
166 | 189 |
|
| 190 | + - name: Debug GitHub ref (Electron) |
| 191 | + run: | |
| 192 | + echo "GitHub ref: ${{ github.ref }}" |
| 193 | + echo "Is tag: ${{ startsWith(github.ref, 'refs/tags/') }}" |
| 194 | + echo "GitHub event name: ${{ github.event_name }}" |
| 195 | +
|
167 | 196 | - name: Upload to GitHub Release |
168 | 197 | if: startsWith(github.ref, 'refs/tags/') |
169 | | - run: npx prebuild -r electron --upload-all |
| 198 | + run: | |
| 199 | + echo "Uploading Electron prebuilds to GitHub release..." |
| 200 | + echo "Current tag: ${{ github.ref_name }}" |
| 201 | + npx prebuild -r electron --upload-all --tag-prefix v |
| 202 | + env: |
| 203 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 204 | + |
| 205 | + # Alternative: Upload to a specific release when running manually |
| 206 | + - name: Upload to Specific Release (Manual) |
| 207 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '' |
| 208 | + run: | |
| 209 | + echo "Uploading Electron prebuilds to release: ${{ github.event.inputs.release_tag }}" |
| 210 | + npx prebuild -r electron --upload-all --tag-prefix v --target ${{ github.event.inputs.release_tag }} |
170 | 211 | env: |
171 | 212 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
172 | 213 |
|
@@ -198,3 +239,39 @@ jobs: |
198 | 239 | run: | |
199 | 240 | TOTAL=$(find prebuilds-artifacts -name "*.node" -o -name "*.tar.gz" | wc -l) |
200 | 241 | echo "Total prebuilds created: $TOTAL" |
| 242 | +
|
| 243 | + # Upload to existing release when manually triggered with a release tag |
| 244 | + - name: Upload to Existing Release |
| 245 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '' |
| 246 | + env: |
| 247 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 248 | + run: | |
| 249 | + echo "Uploading prebuilds to existing release: ${{ github.event.inputs.release_tag }}" |
| 250 | + |
| 251 | + # Create a temporary directory and copy all tar.gz files |
| 252 | + mkdir -p upload-staging |
| 253 | + find prebuilds-artifacts -name "*.tar.gz" -exec cp {} upload-staging/ \; |
| 254 | + |
| 255 | + # Upload each file to the release |
| 256 | + cd upload-staging |
| 257 | + for file in *.tar.gz; do |
| 258 | + echo "Uploading $file..." |
| 259 | + gh release upload "${{ github.event.inputs.release_tag }}" "$file" --clobber |
| 260 | + done |
| 261 | + |
| 262 | + # Create a draft release for testing (when no release tag specified) |
| 263 | + - name: Create Draft Release with Prebuilds |
| 264 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag == '' |
| 265 | + uses: softprops/action-gh-release@v1 |
| 266 | + with: |
| 267 | + draft: true |
| 268 | + tag_name: test-${{ github.run_number }} |
| 269 | + name: Test Release ${{ github.run_number }} |
| 270 | + files: prebuilds-artifacts/**/*.tar.gz |
| 271 | + body: | |
| 272 | + This is a test release created by workflow run #${{ github.run_number }}. |
| 273 | + |
| 274 | + ## Prebuilds included: |
| 275 | + - Node.js versions: 20, 22, 23, 24 |
| 276 | + - Electron versions: 32, 33, 34, 35, 36 |
| 277 | + - Platforms: Windows, Linux, macOS |
0 commit comments