-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (98 loc) · 3.58 KB
/
release.yml
File metadata and controls
114 lines (98 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Release
on:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
publish-crates:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Publish to crates.io
run: |
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
echo "✅ Successfully published to crates.io"
build-release-binaries:
name: Build Release Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: bbl_parser-linux-x64
binary_path: target/release/bbl_parser
- os: macos-latest
artifact_name: bbl_parser-macos-x64
binary_path: target/release/bbl_parser
- os: windows-latest
artifact_name: bbl_parser-windows-x64
binary_path: target/release/bbl_parser.exe
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Build release binary
run: cargo build --release
- name: Create ZIP archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "${{ matrix.binary_path }}" -DestinationPath "bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip"
- name: Create ZIP archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
zip "bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip" "${{ matrix.binary_path }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: bbl_parser-${{ github.ref_name }}-${{ matrix.artifact_name }}.zip
if-no-files-found: error
upload-release-assets:
name: Upload Assets to GitHub Release
needs: build-release-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all ZIP artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: Extract version info
id: version
run: |
SEMVER=$(grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
GIT_SHA="${{ github.sha }}"
GIT_SHA_SHORT="${GIT_SHA:0:7}"
GIT_COMMIT_DATE=$(git log -1 --format=%ci "${{ github.sha }}" | cut -d' ' -f1)
BUILD_INFO="${SEMVER} ${GIT_SHA_SHORT} (${GIT_COMMIT_DATE})"
echo "build_info=$BUILD_INFO" >> $GITHUB_OUTPUT
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
run: |
# Find all ZIP files in artifacts
find release-artifacts -name "*.zip" -type f -exec gh release upload "${{ github.ref_name }}" {} \; --repo "${{ github.repository }}" --clobber
echo "✅ All ZIP binaries uploaded"
- name: Update release notes
env:
GH_TOKEN: ${{ github.token }}
run: |
BUILD_INFO="${{ steps.version.outputs.build_info }}"
gh release edit "${{ github.ref_name }}" \
--notes "**Build Information:** $BUILD_INFO" \
--repo "${{ github.repository }}"
echo "🎉 Release $BUILD_INFO is now live with platform-specific ZIP files!"