-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (113 loc) · 3.42 KB
/
Copy pathrelease-cli.yml
File metadata and controls
133 lines (113 loc) · 3.42 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release CLI
on:
push:
tags:
- "cli-v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. cli-v0.1.0)"
required: true
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: portzero-linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: portzero-linux-aarch64
cross: true
- target: x86_64-apple-darwin
os: macos-latest
name: portzero-darwin-x86_64
- target: aarch64-apple-darwin
os: macos-latest
name: portzero-darwin-aarch64
runs-on: ${{ matrix.os }}
name: CLI / ${{ matrix.name }}
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
# Linux native deps (Pingora needs cmake + protobuf)
- name: Install Linux dependencies
if: runner.os == 'Linux' && !matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y cmake protobuf-compiler build-essential pkg-config
# Cross-compilation for aarch64 Linux
- name: Install cross
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build (native)
if: "!matrix.cross"
run: |
cargo build --release --target ${{ matrix.target }} \
--package portzero-cli
- name: Build (cross)
if: matrix.cross
run: |
cross build --release --target ${{ matrix.target }} \
--package portzero-cli
- name: Package binary
shell: bash
run: |
src="target/${{ matrix.target }}/release/portzero"
dst="${{ matrix.name }}"
mkdir -p "dist"
cp "$src" "dist/portzero"
cd dist
tar czf "../${dst}.tar.gz" portzero
cd ..
rm -rf dist
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}.tar.gz
release:
needs: build
runs-on: ubuntu-latest
name: Publish release
steps:
- uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: artifacts
- name: Determine tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
fi
- name: Generate checksums
working-directory: artifacts
run: |
find . -name '*.tar.gz' -exec mv {} . \;
sha256sum *.tar.gz > SHA256SUMS.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: "CLI ${{ steps.tag.outputs.tag }}"
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/SHA256SUMS.txt