-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (74 loc) · 3.27 KB
/
release.yml
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
name: Cross-Platform Release Build
on:
release:
types:
- created
jobs:
build-linux:
runs-on: ${{ matrix.target.runner }}
strategy:
matrix:
target:
- { triple: x86_64-unknown-linux-gnu, suffix: linux_amd64, file: eth-staking-smith, runner: ubuntu-latest }
- { triple: x86_64-unknown-linux-gnu, suffix: linux_amd64_glibc2.31, file: eth-staking-smith, runner: ubuntu-20.04 }
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y libssl-dev perl make gcc llvm-dev libclang-11-dev clang-11
- name: Set up llvm-config
run: |
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-11 100
- name: Add rustup target
run: rustup target add ${{ matrix.target.triple }}
- name: Build for ${{ matrix.target.triple }}
run: cargo build --target ${{ matrix.target.triple }} --release
- name: Create archive
run: |
mkdir -p dist
tar -czvf dist/${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz -C target/${{ matrix.target.triple }}/release ${{ matrix.target.file }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz
asset_name: ${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz
asset_content_type: application/octet-stream
build-macos:
runs-on: macos-latest
strategy:
matrix:
target:
- { triple: x86_64-apple-darwin, suffix: darwin_amd64, file: eth-staking-smith }
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Add rustup target
run: rustup target add ${{ matrix.target.triple }}
- name: Build for ${{ matrix.target.triple }}
run: cargo build --target ${{ matrix.target.triple }} --release
- name: Create archive
run: |
mkdir -p dist
tar -czvf dist/${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz -C target/${{ matrix.target.triple }}/release ${{ matrix.target.file }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz
asset_name: ${{ matrix.target.file }}_${{ github.event.release.tag_name }}_${{ matrix.target.suffix }}.tar.gz
asset_content_type: application/octet-stream