-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (106 loc) · 4.16 KB
/
rust.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Rust
on:
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install ARM Compiler
run: sudo apt install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Install ARM Target
run: rustup target add aarch64-unknown-linux-gnu
- name: Build arm64
run: cargo build --release --target aarch64-unknown-linux-gnu
- name: Build x64
run: cargo build --release --target x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v3
with:
name: cpub-linux-arm64
path: target/aarch64-unknown-linux-gnu/release/cpub
- uses: actions/upload-artifact@v3
with:
name: cpub-linux-x64
path: target/x86_64-unknown-linux-gnu/release/cpub
build_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install ARM Target
run: rustup target add aarch64-apple-darwin
- name: Build arm64
run: cargo build --release --target aarch64-apple-darwin
- name: Build x64
run: cargo build --release --target x86_64-apple-darwin
- uses: actions/upload-artifact@v3
with:
name: cpub-macos-arm64
path: target/aarch64-apple-darwin/release/cpub
- uses: actions/upload-artifact@v3
with:
name: cpub-macos-x64
path: target/x86_64-apple-darwin/release/cpub
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install ARM Target
run: rustup target add aarch64-pc-windows-msvc
- name: Build arm64
run: cargo build --release --target aarch64-pc-windows-msvc
- name: Build x64
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Code Signing
shell: pwsh
env:
CERT_BASE64: ${{ secrets.WINDOWS_CODESIGN_CERT_BASE64 }}
CERT_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_CERT_PASSWORD }}
run: |
Set-Content -Path codesign.txt -Value $env:CERT_BASE64
certutil -decode codesign.txt codesign.pfx
del codesign.txt
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe' sign /a /f codesign.pfx /p "$env:CERT_PASSWORD" /fd sha256 /tr "http://timestamp.sectigo.com" /td sha256 "target\aarch64-pc-windows-msvc\release\cpub.exe"
& 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe' sign /a /f codesign.pfx /p "$env:CERT_PASSWORD" /fd sha256 /tr "http://timestamp.sectigo.com" /td sha256 "target\x86_64-pc-windows-msvc\release\cpub.exe"
del codesign.pfx
- uses: actions/upload-artifact@v3
with:
name: cpub-windows-arm64
path: target/aarch64-pc-windows-msvc/release/cpub.exe
- uses: actions/upload-artifact@v3
with:
name: cpub-windows-x64
path: target/x86_64-pc-windows-msvc/release/cpub.exe
release:
needs: [ build_linux, build_macos, build_windows ]
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Set exec permission
run: chmod -R 755 artifacts
- name: Generate archives
run: |
zip -j artifacts/cpub-macos-arm64.zip artifacts/cpub-macos-arm64/*
zip -j artifacts/cpub-macos-x64.zip artifacts/cpub-macos-x64/*
zip -j artifacts/cpub-linux-arm64.zip artifacts/cpub-linux-arm64/*
zip -j artifacts/cpub-linux-x64.zip artifacts/cpub-linux-x64/*
zip -j artifacts/cpub-windows-arm64.zip artifacts/cpub-windows-arm64/*
zip -j artifacts/cpub-windows-x64.zip artifacts/cpub-windows-x64/*
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: |
artifacts/cpub-macos-arm64.zip
artifacts/cpub-macos-x64.zip
artifacts/cpub-linux-arm64.zip
artifacts/cpub-linux-x64.zip
artifacts/cpub-windows-arm64.zip
artifacts/cpub-windows-x64.zip