Skip to content

Commit 3ce2b57

Browse files
committed
Cross
1 parent f29d1f3 commit 3ce2b57

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

.github/workflows/rust.yml

+46-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,58 @@
1-
name: Rust
1+
name: Rust Build and Release
22

33
on:
44
push:
55
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
6+
87

98
env:
109
CARGO_TERM_COLOR: always
1110

1211
jobs:
1312
build:
14-
15-
runs-on: ubuntu-latest
13+
name: Build on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ ubuntu-latest, windows-latest, macos-latest ]
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
1625

1726
steps:
18-
- uses: actions/checkout@v4
19-
- name: Build
20-
run: cargo build --release --verbose
21-
27+
- uses: actions/checkout@v4
28+
29+
- name: Install Rust
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: stable
33+
target: ${{ matrix.target }}
34+
override: true
35+
36+
- name: Build
37+
uses: actions-rs/cargo@v1
38+
with:
39+
command: build
40+
args: --release --target ${{ matrix.target }}
41+
42+
- name: Package Binary
43+
shell: bash
44+
run: |
45+
binary_name="merklemap_cli"
46+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
47+
binary_name="${binary_name}.exe"
48+
fi
49+
tar -czf "${binary_name}-${{ matrix.target }}.tar.gz" -C "target/${{ matrix.target }}/release" "${binary_name}"
50+
51+
- name: Release
52+
uses: softprops/action-gh-release@v1
53+
if: startsWith(github.ref, 'refs/tags/')
54+
with:
55+
files: |
56+
merklemap_cli-${{ matrix.target }}.tar.gz
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)