Skip to content

Commit 5bfe9f9

Browse files
committed
ci: Refactor release workflow for cross-platform builds and add macOS support
1 parent 74e7efb commit 5bfe9f9

File tree

1 file changed

+44
-13
lines changed

1 file changed

+44
-13
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,66 @@ on:
77
jobs:
88
release:
99
name: release ${{ matrix.target }}
10-
runs-on: ubuntu-latest
10+
runs-on: ${{ matrix.os }}
1111
strategy:
1212
fail-fast: false
1313
matrix:
1414
include:
15-
- target: x86_64-unknown-linux-musl
15+
# Linux (static musl)
16+
- os: ubuntu-latest
17+
target: x86_64-unknown-linux-musl
1618
archive: tar.gz tar.xz tar.zst
17-
rustflags: ""
18-
- target: x86_64-apple-darwin
19+
# Windows (GNU)
20+
- os: ubuntu-latest
21+
target: x86_64-pc-windows-gnu
1922
archive: zip
20-
# Lower macOS min version to match osxcross SDK (darwin14 -> 10.10)
21-
rustflags: "-C link-arg=-mmacosx-version-min=10.10"
22-
macosx_deployment_target: "10.10"
23-
- target: x86_64-pc-windows-gnu
23+
# macOS (Intel) — build natively to avoid osxcross
24+
- os: macos-13
25+
target: x86_64-apple-darwin
2426
archive: zip
25-
rustflags: ""
2627
steps:
2728
- uses: actions/checkout@v4
2829

29-
- name: Compile and upload to Release
30+
# Linux/Windows: use rust-build.action to compile and upload
31+
- name: Compile and upload (Linux/Windows)
32+
if: matrix.os == 'ubuntu-latest'
3033
uses: rust-build/rust-build.action@v1.4.5
3134
env:
3235
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
# Apply only for macOS target; empty for others
34-
RUSTFLAGS: ${{ matrix.rustflags }}
35-
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
3636
with:
3737
RUSTTARGET: ${{ matrix.target }}
3838
ARCHIVE_TYPES: ${{ matrix.archive }}
3939
EXTRA_FILES: "README.md LICENSE"
4040
STATIC_LINKING: false
4141
TOOLCHAIN_VERSION: 1.83.0
42+
43+
# macOS: native build and upload
44+
- name: Set up Rust 1.83.0 (macOS)
45+
if: matrix.os == 'macos-13'
46+
uses: dtolnay/rust-toolchain@master
47+
with:
48+
toolchain: 1.83.0
49+
50+
- name: Build (macOS)
51+
if: matrix.os == 'macos-13'
52+
run: |
53+
cargo build --release
54+
55+
- name: Package artifact (macOS)
56+
if: matrix.os == 'macos-13'
57+
run: |
58+
mkdir -p dist
59+
cp target/release/prometheus-mcp dist/
60+
cp README.md LICENSE dist/
61+
cd dist
62+
zip -9r ../prometheus-mcp-${{ matrix.target }}.zip .
63+
cd ..
64+
65+
- name: Upload to GitHub Release (macOS)
66+
if: matrix.os == 'macos-13'
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
files: |
70+
prometheus-mcp-${{ matrix.target }}.zip
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)