Skip to content

Commit d35d662

Browse files
authored
Create release_mac.yml
release build for mac
1 parent 8e1e892 commit d35d662

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/release_mac.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release Binaries (macOS)
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on tags starting with "v" (e.g., v1.0.0)
7+
8+
jobs:
9+
build-macos:
10+
name: Build and Release macOS Binaries
11+
runs-on: macos-latest # The job will run on a macOS runner
12+
13+
steps:
14+
# Checkout the repository
15+
- name: Checkout repository
16+
uses: actions/checkout@v4 # Correct use of 'uses' within steps
17+
18+
# Set up Rust toolchain
19+
- name: Set up Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable # Set up the Rust toolchain
21+
22+
# Build for macOS Intel (x86_64)
23+
- name: Build for macOS Intel
24+
run: |
25+
cargo build --release --target x86_64-apple-darwin
26+
27+
# Build for macOS ARM (aarch64)
28+
- name: Build for macOS ARM
29+
run: |
30+
cargo build --release --target aarch64-apple-darwin
31+
32+
# Create the binaries directory if it doesn't exist
33+
- name: Create release binaries directory
34+
run: |
35+
mkdir -p target/release/binaries
36+
37+
# Copy the macOS Intel binary into the binaries directory
38+
- name: Copy macOS Intel binary
39+
run: |
40+
cp target/x86_64-apple-darwin/release/shell_command_menu target/release/binaries/shell_command_menu_intel
41+
42+
# Copy the macOS ARM binary into the binaries directory
43+
- name: Copy macOS ARM binary
44+
run: |
45+
cp target/aarch64-apple-darwin/release/shell_command_menu target/release/binaries/shell_command_menu_arm
46+
47+
# Zip and rename the Intel binary
48+
- name: Zip and rename the macOS Intel binary
49+
run: |
50+
cd target/release/binaries
51+
tar -czf shell_command_menu_macos_intel.tgz shell_command_menu_intel # Create a .tgz archive for Intel
52+
53+
# Zip and rename the ARM binary
54+
- name: Zip and rename the macOS ARM binary
55+
run: |
56+
cd target/release/binaries
57+
tar -czf shell_command_menu_macos_arm.tgz shell_command_menu_arm # Create a .tgz archive for ARM
58+
59+
# Upload the binaries to the GitHub release
60+
- name: Upload binaries to GitHub release
61+
uses: softprops/action-gh-release@v2.2.2 # Use the updated version of gh-release
62+
with:
63+
token: ${{ secrets.GH_PAT_CLI_MENU }} # GitHub token for authentication
64+
files: |
65+
target/release/binaries/shell_command_menu_macos_intel.tgz # Upload the Intel .tgz file
66+
target/release/binaries/shell_command_menu_macos_arm.tgz # Upload the ARM .tgz file

0 commit comments

Comments
 (0)