-
Notifications
You must be signed in to change notification settings - Fork 3
161 lines (132 loc) · 5.36 KB
/
Copy pathci.yaml
File metadata and controls
161 lines (132 loc) · 5.36 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: build
on:
push:
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-latest # rust is installed on the runner
# make this workflow run on self-hosted runner
# runs-on: self-hosted
env:
CARGO_TERM_COLOR: always
steps:
# Install static linking (musl) deps
- name: Install static link deps
run: sudo apt update && sudo apt install -y pkg-config musl-tools libssl-dev
# Setup Rust targets
- name: Setup Rust targets
run: rustup target add x86_64-apple-darwin x86_64-unknown-linux-musl aarch64-apple-darwin
# Use the v1 of this action
- name: Setup OSXCROSS
uses: mbround18/setup-osxcross@v1
# This builds executables & sets env variables for rust to consume.
with:
osx-version: "12.3"
- name: Clone your Code
uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.0
- name: Build for x86 Linux
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Build for x86 macOS
run: cargo build --release --target x86_64-apple-darwin
- name: Build for ARM macOS
run: cargo build --release --target aarch64-apple-darwin
env:
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: aarch64-apple-darwin21.4-clang
CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS: -Car=aarch64-apple-darwin21.4-ar,-Clink-arg=-undefined,-Clink-arg=dynamic_lookup
- name: Build for Universal macOS
run: lipo -create -output target/deepctl-macos target/x86_64-apple-darwin/release/deepctl target/aarch64-apple-darwin/release/deepctl
- uses: actions/upload-artifact@v3
with:
name: deepctl-linux
path: target/x86_64-unknown-linux-musl/release/deepctl
- uses: actions/upload-artifact@v3
with:
name: deepctl-macos
path: target/deepctl-macos
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest # rust is installed on the runner
# make this workflow run on self-hosted runner
# runs-on: self-hosted
env:
CARGO_TERM_COLOR: always
steps:
# Install static linking (musl) deps
- name: Install static link deps
run: sudo apt update && sudo apt install -y pkg-config musl-tools libssl-dev
# Setup Rust targets
- name: Setup Rust targets
run: rustup target add x86_64-apple-darwin x86_64-unknown-linux-musl aarch64-apple-darwin
# Use the v1 of this action
- name: Setup OSXCROSS
uses: mbround18/setup-osxcross@v1
# This builds executables & sets env variables for rust to consume.
with:
osx-version: "12.3"
# Checkout your code
- name: Clone your Code
uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.0
- name: Install apple-codesign
run: cargo install apple-codesign
# Build your code for apple-darwin based release
- name: Build for x86 macOS
run: cargo build --release --target x86_64-apple-darwin
- name: Build for ARM macOS
run: cargo build --release --target aarch64-apple-darwin
env:
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: aarch64-apple-darwin21.4-clang
CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS: -Car=aarch64-apple-darwin21.4-ar,-Clink-arg=-undefined,-Clink-arg=dynamic_lookup
- name: Build for Universal macOS
run: lipo -create -output target/deepctl-macos target/x86_64-apple-darwin/release/deepctl target/aarch64-apple-darwin/release/deepctl
# Build your code for apple-darwin based release
- name: Build for x86 Linux
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Get secrets
env:
CERT_PASSWORD: ${{ secrets.DEEP_INFRA_APPLE_CERT_PASSWORD }}
APP_STORE_CONNECT: ${{ secrets.DEEP_INFRA_APP_STORE_CONNECT }}
SIGNING_CERTIFICATE: ${{ secrets.DEEP_INFRA_SIGNING_CERTIFICATE }}
run: |
echo $CERT_PASSWORD > cert_password
echo $APP_STORE_CONNECT > app_store_connect.json
echo $SIGNING_CERTIFICATE | base64 -di > signing_certificate.p12
- name: Sign the MacOS binary
run: |
ls -la target/*/release/deepctl target/deepctl-macos
echo "Signing the MacOS binary"
rcodesign sign \
--p12-file signing_certificate.p12 --p12-password-file cert_password \
--code-signature-flags runtime \
target/deepctl-macos
echo "Zipping"
zip target/deepctl-macos.zip target/deepctl-macos
echo "Notarizing"
rcodesign notary-submit \
--api-key-path app_store_connect.json \
--wait \
target/deepctl-macos.zip
echo "Done notarizing"
- name: Cleanup secrets
if: always()
run: |
rm cert_password
rm app_store_connect.json
rm signing_certificate.p12
- name: Prepare Release
run: |
mkdir release
cp target/deepctl-macos release/deepctl-macos
cp target/x86_64-unknown-linux-musl/release/deepctl release/deepctl-linux
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
release/deepctl-macos
release/deepctl-linux
install.sh