Skip to content

Commit 1259466

Browse files
committed
refactor: simplify github-release workflow (Option B)
- Rename build-and-release job to 'build' for clarity - Remove redundant 'Build release binary for tag extraction' step - Reuse build_info from needs.build.outputs instead of rebuilding - Extract build info once in build job, propagate via job outputs - Simplify release job: download artifacts → extract tag → create release - Change tag format from 'sha-date' to 'date-sha' for chronological sorting in GitHub UI - Tag computation now explicit: SHORT_SHA and DATE variables - Reduce unnecessary cargo builds and CI time ## Benefits - Cleaner two-job separation (build | release) - No redundant builds - reuse outputs from build job - Better for manual release workflows (no auto-release pressure) - Chronological tag ordering: 2025-12-04-14be1ee - Explicit variable extraction for maintainability
1 parent 0ddc469 commit 1259466

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/github-release.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
RUST_BACKTRACE: 1
1313

1414
jobs:
15-
build-and-release:
15+
build:
1616
name: Build Release Binaries
1717
runs-on: ${{ matrix.os }}
1818
strategy:
@@ -82,7 +82,7 @@ jobs:
8282

8383
create-release:
8484
name: Create GitHub Release
85-
needs: build-and-release
85+
needs: build
8686
runs-on: ubuntu-latest
8787
steps:
8888
- name: Checkout repository
@@ -93,17 +93,20 @@ jobs:
9393
with:
9494
path: release-artifacts
9595

96-
- name: Build release binary for tag extraction
97-
run: cargo build --release
98-
99-
- name: Extract build info and create tag
96+
- name: Extract build info and compute tag
10097
id: release_info
10198
run: |
102-
BUILD_INFO=$(./target/release/bbl_parser -V)
99+
BUILD_INFO="${{ needs.build.outputs.build_info }}"
103100
echo "build_info=$BUILD_INFO" >> $GITHUB_OUTPUT
104101
105-
# Extract short SHA and date from build info (format: "bbl_parser <sha> (<date>)")
106-
TAG_NAME=$(echo "$BUILD_INFO" | awk '{print $2"-"$3}' | tr -d '()')
102+
# Extract short SHA and date from build info
103+
# Format: "bbl_parser <sha> (<date>)"
104+
# Example: "bbl_parser 14be1ee (2025-12-04)"
105+
SHORT_SHA=$(echo "$BUILD_INFO" | awk '{print $2}')
106+
DATE=$(echo "$BUILD_INFO" | awk '{print $3}' | tr -d '()')
107+
108+
# Tag format: date-shortsha for chronological sorting
109+
TAG_NAME="$DATE-$SHORT_SHA"
107110
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
108111
109112
echo "Release tag: $TAG_NAME"

0 commit comments

Comments
 (0)