Skip to content

Commit 82d019f

Browse files
committed
refactor: Switch artifact packaging to ZIP files for releases
CI Changes: - Build ZIP archives instead of loose binaries - ZIP contains only the binary with clean names (bbl_parser or bbl_parser.exe) Release Changes: - Build binaries and ZIP them in release workflow - No longer depend on CI artifacts - Upload only ZIP files to GitHub release - Cleaner release page with versioned ZIP filenames Benefits: - Users get platform-specific, easy-to-recognize files - No loose binary clutter on release page - Consistent with standard software releases
1 parent acad028 commit 82d019f

2 files changed

Lines changed: 66 additions & 107 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,18 @@ jobs:
122122
- name: Build release binary
123123
run: cargo build --release
124124

125+
- name: Create binary ZIP archive
126+
run: |
127+
if [ "${{ runner.os }}" = "Windows" ]; then
128+
zip bbl_parser-${{ matrix.artifact_name }}.zip "${{ matrix.binary_path }}"
129+
else
130+
zip bbl_parser-${{ matrix.artifact_name }}.zip "${{ matrix.binary_path }}"
131+
fi
132+
125133
- name: Upload binary artifact
126134
uses: actions/upload-artifact@v4
127135
with:
128136
name: ${{ matrix.artifact_name }}
129-
path: ${{ matrix.binary_path }}
137+
path: bbl_parser-${{ matrix.artifact_name }}.zip
130138
overwrite: true
131139
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 57 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -26,138 +26,89 @@ 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 (Windows)
57+
if: runner.os == 'Windows'
58+
shell: pwsh
59+
run: |
60+
Compress-Archive -Path "${{ matrix.binary_path }}" -DestinationPath "bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip"
61+
62+
- name: Create ZIP archive (Unix)
63+
if: runner.os != 'Windows'
64+
shell: bash
4365
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
57-
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 }}"
67-
68-
- name: Re-upload artifact for release workflow
66+
zip "bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip" "${{ matrix.binary_path }}"
67+
68+
- name: Upload artifact
6969
uses: actions/upload-artifact@v4
7070
with:
7171
name: ${{ matrix.artifact_name }}
72-
path: ./artifacts/${{ matrix.artifact_name }}/*
73-
overwrite: true
72+
path: bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip
7473
if-no-files-found: error
7574

76-
determine-version:
77-
name: Extract Version Information
78-
needs: download-ci-artifacts
75+
upload-release-assets:
76+
name: Upload Assets to GitHub Release
77+
needs: build-release-binaries
7978
runs-on: ubuntu-latest
80-
outputs:
81-
build_info: ${{ steps.extract.outputs.build_info }}
8279
steps:
8380
- name: Checkout repository
8481
uses: actions/checkout@v4
8582

86-
- name: Extract version from Cargo.toml and git
87-
id: extract
83+
- name: Download all ZIP artifacts
84+
uses: actions/download-artifact@v4
85+
with:
86+
path: release-artifacts
87+
88+
- name: Extract version info
89+
id: version
8890
run: |
89-
set -e
90-
91-
# Extract semver from Cargo.toml
9291
SEMVER=$(grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
93-
94-
# Get git info from GitHub context
9592
GIT_SHA="${{ github.sha }}"
9693
GIT_SHA_SHORT="${GIT_SHA:0:7}"
97-
98-
# Get git commit date from repository (matches VERGEN_GIT_COMMIT_DATE in binary)
9994
GIT_COMMIT_DATE=$(git log -1 --format=%ci "${{ github.sha }}" | cut -d' ' -f1)
100-
101-
# Format version string to match binary output
10295
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
110-
111-
- name: Download Linux binary artifact
112-
uses: actions/download-artifact@v4
113-
with:
114-
name: bbl_parser-linux-x64
115-
path: ./binary-check
96+
echo "build_info=$BUILD_INFO" >> $GITHUB_OUTPUT
11697
117-
- name: Verify version consistency
98+
- name: Upload release assets
11899
env:
119-
BUILD_INFO: ${{ steps.extract.outputs.build_info }}
100+
GH_TOKEN: ${{ github.token }}
120101
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
102+
# Find all ZIP files in artifacts
103+
find release-artifacts -name "*.zip" -type f -exec gh release upload "${{ github.ref_name }}" {} \; --repo "${{ github.repository }}" --clobber
104+
echo "✅ All ZIP binaries uploaded"
134105
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
106+
- name: Update release notes
146107
env:
147108
GH_TOKEN: ${{ github.token }}
148-
GH_REPO: ${{ github.repository }}
149109
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
110+
BUILD_INFO="${{ steps.version.outputs.build_info }}"
158111
gh release edit "${{ github.ref_name }}" \
159112
--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."
113+
--repo "${{ github.repository }}"
114+
echo "🎉 Release $BUILD_INFO is now live with platform-specific ZIP files!"

0 commit comments

Comments
 (0)