14
14
#
15
15
# SPDX-License-Identifier: Apache-2.0
16
16
17
- name : Build CLI Binaries
17
+ name : Build CLI Binaries (RC)
18
18
19
19
on :
20
20
workflow_dispatch :
28
28
required : false
29
29
type : boolean
30
30
default : false
31
- promote_rc :
32
- description : ' Promote RC to final release (requires signed binaries)'
33
- required : false
34
- type : boolean
35
- default : false
36
31
37
32
jobs :
38
33
build :
@@ -284,7 +279,9 @@ jobs:
284
279
create-rc :
285
280
needs : [build, test]
286
281
runs-on : ubuntu-latest
287
- if : inputs.create_rc == 'true'
282
+ if : inputs.create_rc
283
+ outputs :
284
+ upload_url : ${{ steps.create_rc.outputs.upload_url }}
288
285
289
286
steps :
290
287
- name : Checkout code
@@ -352,7 +349,7 @@ jobs:
352
349
upload-rc-assets :
353
350
needs : [build, test, create-rc]
354
351
runs-on : ubuntu-latest
355
- if : inputs.create_rc == 'true'
352
+ if : inputs.create_rc
356
353
strategy :
357
354
matrix :
358
355
include :
@@ -386,223 +383,38 @@ jobs:
386
383
with :
387
384
upload_url : ${{ needs.create-rc.outputs.upload_url }}
388
385
asset_path : ./genkit-${{ matrix.target }}${{ steps.binary.outputs.ext }}
389
- asset_name : genkit-${{ matrix.target }}
386
+ asset_name : genkit-${{ matrix.target }}${{ steps.binary.outputs.ext }}
390
387
asset_content_type : application/octet-stream
391
388
392
- promote-to-release :
393
- needs : [build, test]
394
- runs-on : ubuntu-latest
395
- if : inputs.promote_rc == 'true'
396
-
397
- steps :
398
- - name : Checkout code
399
- uses : actions/checkout@v4
400
-
401
- # Note: After RC creation, signed binaries should be uploaded via Kokoro
402
- # before running promote_rc. The promotion assumes signed binaries are
403
- # available for the final release.
404
- - name : Validate signed binaries exist
405
- run : |
406
- RC_VERSION="${{ inputs.version }}"
407
- FINAL_VERSION="${RC_VERSION%-rc*}"
408
-
409
- echo "Validating signed binaries exist for RC: $RC_VERSION"
410
- echo "Will promote to final version: $FINAL_VERSION"
411
-
412
- # Expected platforms that should have signed binaries
413
- EXPECTED_PLATFORMS=("linux-x64" "linux-arm64" "darwin-x64" "darwin-arm64" "win32-x64")
414
-
415
- # Check if RC release exists and get its assets
416
- RELEASE_INFO=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
417
- "https://api.github.com/repos/firebase/genkit/releases/tags/$RC_VERSION")
418
-
419
- if [[ $(echo "$RELEASE_INFO" | jq -r '.id') == "null" ]]; then
420
- echo "❌ Error: RC release $RC_VERSION not found"
421
- exit 1
422
- fi
423
-
424
- echo "✓ RC release $RC_VERSION found"
425
-
426
- # Get list of assets from the RC release
427
- ASSETS=$(echo "$RELEASE_INFO" | jq -r '.assets[].name' | sort)
428
-
429
- # Check for expected signed binaries
430
- MISSING_BINARIES=()
431
- for platform in "${EXPECTED_PLATFORMS[@]}"; do
432
- if [[ "$platform" == win32-* ]]; then
433
- expected_file="genkit-$platform.exe"
434
- else
435
- expected_file="genkit-$platform"
436
- fi
437
-
438
- if ! echo "$ASSETS" | grep -q "^$expected_file$"; then
439
- MISSING_BINARIES+=("$expected_file")
440
- else
441
- echo "✓ Found signed binary: $expected_file"
442
- fi
443
- done
444
-
445
- if [[ ${#MISSING_BINARIES[@]} -gt 0 ]]; then
446
- echo "❌ Missing signed binaries:"
447
- printf ' - %s\n' "${MISSING_BINARIES[@]}"
448
- echo ""
449
- echo "Please ensure all binaries are signed before promoting to final release."
450
- echo "You can trigger the signing workflow or manually upload signed binaries."
451
- exit 1
452
- fi
453
-
454
- echo "✅ All expected signed binaries found in RC release"
455
-
456
- - name : Generate changelog
457
- id : changelog
458
- run : |
459
- # Get the previous release tag
460
- PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
461
-
462
- if [[ -n "$PREVIOUS_TAG" ]]; then
463
- # Generate changelog from previous tag to current
464
- CHANGELOG=$(git log --pretty=format:"- %s" $PREVIOUS_TAG..HEAD | head -20)
465
- echo "changelog<<EOF" >> $GITHUB_OUTPUT
466
- echo "$CHANGELOG" >> $GITHUB_OUTPUT
467
- echo "EOF" >> $GITHUB_OUTPUT
468
- else
469
- # First release
470
- echo "changelog<<EOF" >> $GITHUB_OUTPUT
471
- echo "- Initial release" >> $GITHUB_OUTPUT
472
- echo "EOF" >> $GITHUB_OUTPUT
473
- fi
474
-
475
- - name : Create Final Release
476
- id : create_release
477
- uses : actions/create-release@v1
478
- env :
479
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
480
- with :
481
- tag_name : ${{ inputs.version }}
482
- release_name : Genkit CLI ${{ inputs.version }}
483
- body : |
484
- # Genkit CLI ${{ inputs.version }}
485
-
486
- ## Downloads
487
-
488
- - [Linux x64](https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-linux-x64)
489
- - [Linux ARM64](https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-linux-arm64)
490
- - [macOS x64](https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-darwin-x64)
491
- - [macOS ARM64](https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-darwin-arm64)
492
- - [Windows x64](https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-win32-x64.exe)
493
-
494
- ## Changes
495
-
496
- ${{ steps.changelog.outputs.changelog }}
497
-
498
- ## Installation
499
-
500
- ### Quick Install (Recommended)
501
-
502
- ```bash
503
- curl -sL https://genkit.tools | bash
504
- ```
505
-
506
- ### Manual Installation
507
-
508
- ```bash
509
- # Download the appropriate binary for your platform
510
- curl -Lo genkit https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
511
-
512
- # Make it executable
513
- chmod +x genkit
514
-
515
- # Move to a directory in your PATH
516
- sudo mv genkit /usr/local/bin/
517
-
518
- # Verify installation
519
- genkit --version
520
- ```
521
-
522
- ### Windows Installation
523
-
524
- ```powershell
525
- # Download the Windows binary
526
- Invoke-WebRequest -Uri "https://github.com/firebase/genkit/releases/download/${{ inputs.version }}/genkit-win32-x64.exe" -OutFile "genkit.exe"
527
-
528
- # Add to PATH or run from current directory
529
- .\genkit.exe --version
530
- ```
531
-
532
- ## Documentation
533
-
534
- For more information, visit [https://firebase.google.com/docs/genkit/](https://firebase.google.com/docs/genkit/)
535
- draft : false
536
- prerelease : false
537
-
538
- upload-release-assets :
539
- needs : [build, test, promote-to-release]
389
+ create-rc-summary :
390
+ needs : [upload-rc-assets]
540
391
runs-on : ubuntu-latest
541
- if : inputs.promote_rc == 'true'
542
- strategy :
543
- matrix :
544
- include :
545
- - target : linux-x64
546
- - target : linux-arm64
547
- - target : darwin-x64
548
- - target : darwin-arm64
549
- - target : win32-x64
392
+ if : inputs.create_rc
550
393
551
394
steps :
552
- - name : Set binary extension
553
- id : binary
554
- shell : bash
395
+ - name : Create job summary
555
396
run : |
556
- if [[ "${{ matrix.target }}" == win32-* ]]; then
557
- echo "ext=.exe" >> $GITHUB_OUTPUT
558
- else
559
- echo "ext=" >> $GITHUB_OUTPUT
560
- fi
561
-
562
- - name : Download binary artifact
563
- uses : actions/download-artifact@v4
564
- with :
565
- name : genkit-${{ matrix.target }}
566
- path : ./
567
-
568
- - name : Upload to GitHub Release
569
- uses : actions/upload-release-asset@v1
570
- env :
571
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
572
- with :
573
- upload_url : ${{ needs.promote-to-release.outputs.upload_url }}
574
- asset_path : ./genkit-${{ matrix.target }}${{ steps.binary.outputs.ext }}
575
- asset_name : genkit-${{ matrix.target }}
576
- asset_content_type : application/octet-stream
397
+ echo "# 🎉 Genkit CLI Release Candidate Created" >> $GITHUB_STEP_SUMMARY
398
+ echo "" >> $GITHUB_STEP_SUMMARY
399
+ echo "**Version:** \`${{ inputs.version }}\`" >> $GITHUB_STEP_SUMMARY
400
+ echo "" >> $GITHUB_STEP_SUMMARY
401
+ echo "## ✅ Build Status" >> $GITHUB_STEP_SUMMARY
402
+ echo "" >> $GITHUB_STEP_SUMMARY
403
+ echo "All binaries have been successfully built and uploaded!" >> $GITHUB_STEP_SUMMARY
404
+ echo "" >> $GITHUB_STEP_SUMMARY
405
+ echo "### 📦 Available Binaries:" >> $GITHUB_STEP_SUMMARY
406
+ echo "- ✓ Linux x64 (\`genkit-linux-x64\`)" >> $GITHUB_STEP_SUMMARY
407
+ echo "- ✓ Linux ARM64 (\`genkit-linux-arm64\`)" >> $GITHUB_STEP_SUMMARY
408
+ echo "- ✓ macOS x64 (\`genkit-darwin-x64\`)" >> $GITHUB_STEP_SUMMARY
409
+ echo "- ✓ macOS ARM64 (\`genkit-darwin-arm64\`)" >> $GITHUB_STEP_SUMMARY
410
+ echo "- ✓ Windows x64 (\`genkit-win32-x64.exe\`)" >> $GITHUB_STEP_SUMMARY
411
+ echo "" >> $GITHUB_STEP_SUMMARY
412
+ echo "### 🔗 Release Links" >> $GITHUB_STEP_SUMMARY
413
+ echo "- [View Release](https://github.com/${{ github.repository }}/releases/tag/${{ inputs.version }})" >> $GITHUB_STEP_SUMMARY
414
+ echo "- [Download Binaries](https://github.com/${{ github.repository }}/releases/tag/${{ inputs.version }}#assets)" >> $GITHUB_STEP_SUMMARY
415
+ echo "" >> $GITHUB_STEP_SUMMARY
416
+ echo "### 📝 Next Steps" >> $GITHUB_STEP_SUMMARY
417
+ echo "1. Test the RC binaries" >> $GITHUB_STEP_SUMMARY
418
+ echo "2. Sign the binaries using the manual workflow" >> $GITHUB_STEP_SUMMARY
419
+ echo "3. Promote to final release using the 'Promote CLI Release' workflow" >> $GITHUB_STEP_SUMMARY
577
420
578
- update-latest-tag :
579
- needs : [promote-to-release, upload-release-assets]
580
- runs-on : ubuntu-latest
581
- if : inputs.promote_rc == 'true'
582
-
583
- steps :
584
- - name : Checkout code
585
- uses : actions/checkout@v4
586
- with :
587
- token : ${{ secrets.GITHUB_TOKEN }}
588
-
589
- - name : Update latest tag
590
- run : |
591
- # Check if latest tag already points to the correct version
592
- CURRENT_LATEST=$(git rev-parse latest 2>/dev/null || echo "")
593
- TARGET_COMMIT=$(git rev-parse ${{ inputs.version }} 2>/dev/null || echo "")
594
-
595
- if [[ "$CURRENT_LATEST" == "$TARGET_COMMIT" ]]; then
596
- echo "Latest tag already points to ${{ inputs.version }}"
597
- exit 0
598
- fi
599
-
600
- # Delete the existing "latest" tag if it exists
601
- git tag -d latest 2>/dev/null || true
602
- git push origin :refs/tags/latest 2>/dev/null || true
603
-
604
- # Create new "latest" tag pointing to the release tag
605
- git tag latest ${{ inputs.version }}
606
- git push origin latest
607
-
608
- echo "Updated 'latest' tag to point to ${{ inputs.version }}"
0 commit comments