forked from rustdesk/rustdesk-server
-
-
Notifications
You must be signed in to change notification settings - Fork 20
87 lines (76 loc) · 2.82 KB
/
ubuntu.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
name: Build for Ubuntu 22.04
on:
push:
branches:
- tcpserver-master-build
jobs:
build:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: write
packages: write
attestations: write
env:
TARGET: x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up environment
run: |
sudo apt-get update
sudo apt-get install -y curl build-essential debhelper devscripts pkg-config libssl-dev libsqlite3-dev zip musl-dev musl-tools
- name: Install Rust toolchain
uses: crusty-pie/toolchain@main
with:
profile: minimal
toolchain: stable
override: true
targets: ${{env.TARGET}}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ubuntu-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ubuntu-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ubuntu-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Build project
run: |
cargo update -p sctgdesk-api-server
DATABASE_URL=sqlite://$(pwd)/db_v2.sqlite3 cargo build --target=${{env.TARGET}} --release
zip -r /tmp/linux_${{env.TARGET}}.zip target/${{env.TARGET}}/release/hbbs target/${{env.TARGET}}/release/hbbr target/${{env.TARGET}}/release/rustdesk-utils
- name: Attest release
uses: actions/attest-build-provenance@v1
with:
subject-path: "target/${{env.TARGET}}/release/hbbs, target/${{env.TARGET}}/release/hbbr, target/${{env.TARGET}}/release/rustdesk-utils"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ubuntu_amd64
path: |
target/${{env.TARGET}}release/hbbs
target/${{env.TARGET}}release/hbbr
target/${{env.TARGET}}release/rustdesk-utils
/tmp/linux_${{env.TARGET}}.zip
- name: Create Release with gh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
export TAG_NAME=${{ github.event.release.tag_name }}
export TAG_NAME=${TAG_NAME:-"nightly"}
echo $TAG_NAME
mv /tmp/linux_${{env.TARGET}}.zip /tmp/linux_${{env.TARGET}}_${TAG_NAME}.zip
gh release create $TAG_NAME -t "$TAG_NAME" -n "$TAG_NAME" || true
gh release upload $TAG_NAME /tmp/linux_${{env.TARGET}}_${TAG_NAME}.zip --clobber