-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (76 loc) · 3.16 KB
/
build-macos-x64.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
name: Build for mac-x64
on: workflow_dispatch
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: macos-11
environment: PROD
env:
SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }}
SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }}
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust toolchain and components
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Create empty .env file
run: touch .env
# Build the modules
- name: Release build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --verbose
# Run tests
- name: Run tests
run: cargo test --verbose
# # Sign the executable
# - name: Codesign binary
# env:
# MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
# MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
# MACOS_FULL_IDENTITY: ${{ secrets.MACOS_FULL_IDENTITY }}
# run: |
# echo $MACOS_CERTIFICATE | openssl base64 -d -A > certificate.p12
# security create-keychain -p $MACOS_CERTIFICATE_PWD build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p $MACOS_CERTIFICATE_PWD build.keychain
# security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CERTIFICATE_PWD build.keychain
# cd __build__binary__
# /usr/bin/codesign -f -s "$MACOS_FULL_IDENTITY" --entitlements ../.github/macos-build-entitlements.plist --options=runtime --timestamp ./mqttrelay
# zip ./mqttrelay.zip ./mqttrelay
# /usr/bin/codesign -f -s "$MACOS_FULL_IDENTITY" --options=runtime --timestamp ./mqttrelay.zip
# # Notarize app using xcrun altool
# - name: Notarize binary
# env:
# MACOS_DEVELOPER_EMAIL: ${{ secrets.MACOS_DEVELOPER_EMAIL }}
# MACOS_DEVELOPER_PWD: ${{ secrets.MACOS_DEVELOPER_PWD }}
# MACOS_BUNDLE_ID: ${{ secrets.MACOS_BUNDLE_ID }}
# MACOS_ASC_PROVIDER: ${{ secrets.MACOS_ASC_PROVIDER }}
# run: xcrun altool --notarize-app --primary-bundle-id "$MACOS_BUNDLE_ID" -u "$MACOS_DEVELOPER_EMAIL" -p "$MACOS_DEVELOPER_PWD" --asc-provider "$MACOS_ASC_PROVIDER" -f ./__build__binary__/mqttrelay.zip
# Zip the binary
- name: Generate tar.gz
run: |
cd target/release
tar cvf - tago-relay | gzip > ../tago-relay-mac-x64.tar.gz
# Upload the zip file as an artifact
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: tago-relay-macos-x64
path: target/tago-relay-mac-x64.tar.gz