-
Notifications
You must be signed in to change notification settings - Fork 33
90 lines (76 loc) · 2.93 KB
/
build_and_upload.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
# .github/workflows/build_and_upload.yml
name: Build and Upload
on: [push]
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
dir: musl
- os: windows-latest
target: x86_64-pc-windows-msvc
dir: windows
- os: macos-latest
target: x86_64-apple-darwin
dir: macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
# Install prerequisites
- name: Install musl-tools (Linux)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y musl-tools
# Setup Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
# Caching
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git
- name: Cache cargo build
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-cargo-build-target
# Build steps for each specific application, including conditions for OS
- name: Build geph5-client (Linux)
if: matrix.os == 'ubuntu-latest'
run: cargo build --locked --release --target x86_64-unknown-linux-musl --manifest-path binaries/geph5-client/Cargo.toml
- name: Build geph5-client (Windows)
if: matrix.os == 'windows-latest'
run: cargo build --locked --release --target x86_64-pc-windows-msvc --manifest-path binaries/geph5-client/Cargo.toml
- name: Build geph5-client (macOS)
if: matrix.os == 'macos-latest'
run: cargo build --locked --release --target x86_64-apple-darwin --manifest-path binaries/geph5-client/Cargo.toml
- name: Move binaries
run: |
mkdir artifacts
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then mv target/x86_64-unknown-linux-musl/release/geph5-client artifacts; fi
if [ "${{ matrix.os }}" = "windows-latest" ]; then mv target/x86_64-pc-windows-msvc/release/geph5-client.exe artifacts; fi
if [ "${{ matrix.os }}" = "macos-latest" ]; then mv target/x86_64-apple-darwin/release/geph5-client artifacts; fi
shell: bash
# Upload to Cloudflare R2
- name: Upload to Cloudflare R2
uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
r2-bucket: geph5
source-dir: ./artifacts/
destination-dir: ./${{ matrix.dir }}-latest