-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9315574
commit e5c8eaf
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Cross-Platform Release Build | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: | ||
- { triple: x86_64-unknown-linux-gnu, suffix: linux_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: 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 |