Enhance CI status checks in script to include total counts and handle… #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FC Versions | |
| on: | |
| push: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| # Run parallel builds via reusable workflow | |
| build: | |
| uses: ./.github/workflows/build.yml | |
| # Check CI status in parallel with builds (for faster feedback) | |
| check-ci: | |
| name: Check FC repo CI status | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ci_passed: ${{ steps.ci-check.outputs.ci_passed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check CI status for all versions | |
| id: ci-check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| output=$(./scripts/check-fc-ci.sh firecracker_versions.txt) | |
| echo "$output" | |
| # Extract ci_passed from last line | |
| ci_passed=$(echo "$output" | grep "^ci_passed=" | cut -d= -f2) | |
| echo "ci_passed=$ci_passed" >> $GITHUB_OUTPUT | |
| # Collect artifacts and publish (waits for both build and CI check) | |
| publish: | |
| name: Collect and upload builds | |
| needs: [build, check-ci] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Download all build artifacts | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: builds | |
| pattern: firecracker-* | |
| merge-multiple: true | |
| - name: List downloaded builds | |
| run: find builds -type f | head -20 | |
| - name: CI check result | |
| run: | | |
| echo "CI check passed: ${{ needs.check-ci.outputs.ci_passed }}" | |
| if [[ "${{ needs.check-ci.outputs.ci_passed }}" != "true" ]]; then | |
| echo "⚠️ CI checks did not pass - skipping GCS upload and release" | |
| fi | |
| - name: Setup Service Account | |
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| project_id: ${{ secrets.GCP_PROJECT_ID }} | |
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
| - name: Upload firecrackers to GCS | |
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | |
| uses: "google-github-actions/upload-cloud-storage@v1" | |
| with: | |
| path: "./builds" | |
| destination: ${{ vars.GCP_BUCKET_NAME }}/firecrackers | |
| gzip: false | |
| parent: false | |
| - name: Create releases for each Firecracker version | |
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| for dir in ./builds/*/; do | |
| version_name=$(basename "$dir") | |
| binary_path="$dir/firecracker" | |
| echo "Processing $version_name..." | |
| # Check if tag already exists | |
| if git rev-parse "refs/tags/$version_name" >/dev/null 2>&1; then | |
| echo "Tag $version_name already exists, skipping..." | |
| continue | |
| fi | |
| # Check if release already exists | |
| if gh release view "$version_name" >/dev/null 2>&1; then | |
| echo "Release $version_name already exists, skipping..." | |
| continue | |
| fi | |
| echo "Creating tag and release for $version_name..." | |
| # Create and push tag | |
| git tag "$version_name" | |
| git push origin "$version_name" | |
| # Create release with the binary | |
| gh release create "$version_name" \ | |
| --title "Firecracker $version_name" \ | |
| --notes "Firecracker build: $version_name" \ | |
| "$binary_path#${version_name}" | |
| done |