@@ -26,138 +26,86 @@ jobs:
2626 cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
2727 echo "✅ Successfully published to crates.io"
2828
29- download-ci-artifacts :
30- name : Download CI Build Artifacts
31- runs-on : ubuntu-latest
29+ build-release-binaries :
30+ name : Build Release Binaries
31+ runs-on : ${{ matrix.os }}
3232 strategy :
3333 matrix :
34- artifact_name :
35- - bbl_parser-linux-x64
36- - bbl_parser-windows-x64
37- - bbl_parser-macos-x64
34+ include :
35+ - os : ubuntu-latest
36+ artifact_name : bbl_parser-linux-x64
37+ binary_path : target/release/bbl_parser
38+ - os : macos-latest
39+ artifact_name : bbl_parser-macos-x64
40+ binary_path : target/release/bbl_parser
41+ - os : windows-latest
42+ artifact_name : bbl_parser-windows-x64
43+ binary_path : target/release/bbl_parser.exe
3844 steps :
39- - name : Download artifact from CI workflow using GitHub CLI
40- env :
41- GH_TOKEN : ${{ github.token }}
42- GH_REPO : ${{ github.repository }}
45+ - name : Checkout repository
46+ uses : actions/checkout@v4
47+
48+ - name : Install Rust toolchain
49+ uses : actions-rust-lang/setup-rust-toolchain@v1
50+ with :
51+ toolchain : stable
52+
53+ - name : Build release binary
54+ run : cargo build --release
55+
56+ - name : Create ZIP archive
57+ shell : bash
4358 run : |
44- # Find the most recent successful ci.yml run for this commit
45- RUN_ID=$(gh run list \
46- --workflow=ci.yml \
47- --commit=${{ github.sha }} \
48- --status=success \
49- --limit=1 \
50- --json databaseId \
51- --jq '.[0].databaseId')
52-
53- if [ -z "$RUN_ID" ]; then
54- echo "❌ No successful ci.yml run found for commit ${{ github.sha }}"
55- echo "Make sure ci.yml completed successfully before publishing release"
56- exit 1
59+ if [ "${{ runner.os }}" = "Windows" ]; then
60+ powershell -Command "Compress-Archive -Path '${{ matrix.binary_path }}' -DestinationPath 'bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip'"
61+ else
62+ zip "bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip" "${{ matrix.binary_path }}"
5763 fi
58-
59- echo "📦 Downloading ${{ matrix.artifact_name }} from run ID: $RUN_ID"
60-
61- # Download the artifact
62- gh run download "$RUN_ID" \
63- --name "${{ matrix.artifact_name }}" \
64- --dir ./artifacts/${{ matrix.artifact_name }}
65-
66- echo "✅ Successfully downloaded ${{ matrix.artifact_name }}"
6764
68- - name : Re-upload artifact for release workflow
65+ - name : Upload artifact
6966 uses : actions/upload-artifact@v4
7067 with :
7168 name : ${{ matrix.artifact_name }}
72- path : ./artifacts/${{ matrix.artifact_name }}/*
73- overwrite : true
69+ path : bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip
7470 if-no-files-found : error
7571
76- determine-version :
77- name : Extract Version Information
78- needs : download-ci-artifacts
72+ upload-release-assets :
73+ name : Upload Assets to GitHub Release
74+ needs : build-release-binaries
7975 runs-on : ubuntu-latest
80- outputs :
81- build_info : ${{ steps.extract.outputs.build_info }}
8276 steps :
8377 - name : Checkout repository
8478 uses : actions/checkout@v4
8579
86- - name : Extract version from Cargo.toml and git
87- id : extract
80+ - name : Download all ZIP artifacts
81+ uses : actions/download-artifact@v4
82+ with :
83+ path : release-artifacts
84+
85+ - name : Extract version info
86+ id : version
8887 run : |
89- set -e
90-
91- # Extract semver from Cargo.toml
9288 SEMVER=$(grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
93-
94- # Get git info from GitHub context
9589 GIT_SHA="${{ github.sha }}"
9690 GIT_SHA_SHORT="${GIT_SHA:0:7}"
97-
98- # Get git commit date from repository (matches VERGEN_GIT_COMMIT_DATE in binary)
9991 GIT_COMMIT_DATE=$(git log -1 --format=%ci "${{ github.sha }}" | cut -d' ' -f1)
100-
101- # Format version string to match binary output
10292 BUILD_INFO="${SEMVER} ${GIT_SHA_SHORT} (${GIT_COMMIT_DATE})"
103-
104- echo "✅ Extracted version: $BUILD_INFO"
105-
106- # Write output with proper quoting
107- echo "build_info<<EOF" >> $GITHUB_OUTPUT
108- echo "$BUILD_INFO" >> $GITHUB_OUTPUT
109- echo "EOF" >> $GITHUB_OUTPUT
93+ echo "build_info=$BUILD_INFO" >> $GITHUB_OUTPUT
11094
111- - name : Download Linux binary artifact
112- uses : actions/download-artifact@v4
113- with :
114- name : bbl_parser-linux-x64
115- path : ./binary-check
116-
117- - name : Verify version consistency
95+ - name : Upload release assets
11896 env :
119- BUILD_INFO : ${{ steps.extract.outputs.build_info }}
97+ GH_TOKEN : ${{ github.token }}
12098 run : |
121- set -e
122-
123- chmod +x ./binary-check/bbl_parser
124- BINARY_VERSION=$(./binary-check/bbl_parser -V)
125- EXPECTED="bbl_parser ${BUILD_INFO}"
126- if [ "$BINARY_VERSION" = "$EXPECTED" ]; then
127- echo "✅ Version match confirmed: binary='$BINARY_VERSION'"
128- else
129- echo "❌ Version mismatch detected:"
130- echo " Binary output: '$BINARY_VERSION'"
131- echo " Expected: '$EXPECTED'"
132- exit 1
133- fi
99+ # Find all ZIP files in artifacts
100+ find release-artifacts -name "*.zip" -type f -exec gh release upload "${{ github.ref_name }}" {} \; --repo "${{ github.repository }}" --clobber
101+ echo "✅ All ZIP binaries uploaded"
134102
135- upload-release-assets :
136- name : Upload Assets to GitHub Release
137- needs : [download-ci-artifacts, determine-version]
138- runs-on : ubuntu-latest
139- steps :
140- - name : Download all artifacts
141- uses : actions/download-artifact@v4
142- with :
143- path : release-artifacts
144-
145- - name : Upload release assets
103+ - name : Update release notes
146104 env :
147105 GH_TOKEN : ${{ github.token }}
148- GH_REPO : ${{ github.repository }}
149106 run : |
150- BUILD_INFO="${{ needs.determine-version.outputs.build_info }}"
151-
152- # Upload all artifacts for this release
153- gh release upload "${{ github.ref_name }}" release-artifacts/*/* \
154- --repo "$GH_REPO" \
155- --clobber
156-
157- # Update release notes with build information
107+ BUILD_INFO="${{ steps.version.outputs.build_info }}"
158108 gh release edit "${{ github.ref_name }}" \
159109 --notes "**Build Information:** $BUILD_INFO" \
160- --repo "$GH_REPO"
161- echo "✅ Release notes updated with build information"
162- echo ""
163- echo "🎉 Release complete! Version $BUILD_INFO is now live."
110+ --repo "${{ github.repository }}"
111+ echo "🎉 Release $BUILD_INFO is now live with platform-specific ZIP files!"
0 commit comments