-
Notifications
You must be signed in to change notification settings - Fork 6
90 lines (80 loc) · 2.81 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: pop release
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
ref:
description: ref to build binary from
required: false
push:
branches:
- 'frank/build-macos'
jobs:
build-node:
runs-on: ${{ matrix.platform.os }}
permissions:
contents: write
strategy:
matrix:
platform:
# Linux
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
cpu: skylake
# macOS
- os: macos-14
target: aarch64-apple-darwin
- os: macos-14
target: x86_64-apple-darwin
env:
RUSTFLAGS: "${{ matrix.platform.cpu != '' && format('-C target-cpu={0}', matrix.platform.cpu) || '' }} ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' && '-C linker=aarch64-linux-gnu-gcc' || '' }}"
path: "target/${{ matrix.platform.target }}/production"
package: "pop-node-${{ matrix.platform.target }}${{ matrix.platform.cpu != '' && format('-{0}', matrix.platform.cpu) || '' }}.tar.gz"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.ref }}
- name: Install packages (Linux)
if: contains(matrix.platform.target, 'linux')
run: |
sudo apt-get install -y protobuf-compiler ${{ contains(matrix.platform.target, 'aarch64') && 'crossbuild-essential-arm64' || '' }}
protoc --version
- name: Install packages (macOS)
if: contains(matrix.platform.target, 'apple')
run: |
brew install protobuf
protoc --version
- name: Add target
run: rustup target add ${{ matrix.platform.target }}
- name: Build node
run: cargo build --profile=production -p pop-node --target ${{ matrix.platform.target }}
- name: Package binary (Linux)
if: contains(matrix.platform.target, 'linux')
run: |
cd ${{ env.path }}
sha256sum pop-node > pop-node.sha256
tar -czf ${{ env.package }} pop-node pop-node.sha256
- name: Package binary (macOS)
if: contains(matrix.platform.target, 'apple')
run: |
cd ${{ env.path }}
shasum -a 256 pop-node > pop-node.sha256
tar -czf ${{ env.package }} pop-node pop-node.sha256
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: binaries
path: ${{ env.path }}/${{ env.package }}
- name: Add binary to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.path }}/${{ env.package }}