-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 添加构建deb包相关基础 * 补齐工作流,等待验证 * 修复构建时没有创建的data目录保障deb包构建 * 修复其余架构deb包构建中的依赖错误 * 修复:由于小改工作流导致写错架构的问题 * 修复拼写错误导致的目录错误 * 添加上传工件,和发布rel工作流,完成相关事务 --------- Co-authored-by: ymwl <[email protected]>
- Loading branch information
Showing
12 changed files
with
202 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ env: | |
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -57,6 +56,11 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: lejianwen/rustdesk-api-web | ||
path: rustdesk-api-web | ||
ref: master | ||
|
||
- name: Set up Go environment | ||
uses: actions/setup-go@v4 | ||
|
@@ -68,14 +72,12 @@ jobs: | |
with: | ||
node-version: '20' | ||
|
||
|
||
- name: build rustdesk-api-web | ||
working-directory: rustdesk-api-web | ||
run: | | ||
git clone ${{ env.WEBCLIENT_SOURCE_LOCATION }} | ||
cd rustdesk-api-web | ||
npm install | ||
npm run build | ||
mkdir ../resources/admin/ -p | ||
mkdir -p ../resources/admin/ | ||
cp -ar dist/* ../resources/admin/ | ||
- name: tidy | ||
|
@@ -97,48 +99,103 @@ jobs: | |
mkdir -p release/runtime | ||
if [ "${{ matrix.job.goos }}" = "windows" ]; then | ||
sudo apt-get install gcc-mingw-w64-x86-64 zip -y | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go | ||
zip -r ${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} ./release | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/rustdesk-api.exe ./cmd/apimain.go | ||
else | ||
if [ "${{ matrix.job.platform }}" = "arm64" ]; then | ||
wget https://musl.cc/aarch64-linux-musl-cross.tgz | ||
tar -xf aarch64-linux-musl-cross.tgz | ||
export PATH=$PATH:$PWD/aarch64-linux-musl-cross/bin | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/rustdesk-api ./cmd/apimain.go | ||
elif [ "${{ matrix.job.platform }}" = "armv7l" ]; then | ||
wget https://musl.cc/armv7l-linux-musleabihf-cross.tgz | ||
tar -xf armv7l-linux-musleabihf-cross.tgz | ||
export PATH=$PATH:$PWD/armv7l-linux-musleabihf-cross/bin | ||
GOOS=${{ matrix.job.goos }} GOARCH=arm GOARM=7 CC=armv7l-linux-musleabihf-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go | ||
GOOS=${{ matrix.job.goos }} GOARCH=arm GOARM=7 CC=armv7l-linux-musleabihf-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/rustdesk-api ./cmd/apimain.go | ||
else | ||
sudo apt-get install musl musl-dev musl-tools -y | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go | ||
GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/rustdesk-api ./cmd/apimain.go | ||
fi | ||
tar -czf ${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} ./release | ||
fi | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }} | ||
path: | | ||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} | ||
./release/* | ||
- name: Upload to GitHub Release | ||
if: github.event_name == 'release' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: | | ||
${{ matrix.job.goos}}-${{ matrix.job.platform }}.${{matrix.job.file_ext}} | ||
# tag_name: ${{ env.LATEST_TAG }} | ||
${{ matrix.job.goos}}-${{ matrix.job.platform }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Generate Changelog | ||
if: github.event_name == 'release' | ||
run: npx changelogithub # or [email protected] if ensure the stable result | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
deb-package: | ||
name: debian package - ${{ matrix.job.platform }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
job: | ||
- { platform: "amd64", goos: "linux", debian_platform: "amd64", crossbuild_package: ""} | ||
- { platform: "arm64", goos: "linux", debian_platform: "arm64", crossbuild_package: "crossbuild-essential-arm64" } | ||
- { platform: "armv7l", goos: "linux", debian_platform: "armhf", crossbuild_package: "crossbuild-essential-armhf" } | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Create packaging env | ||
run: | | ||
sudo apt update | ||
DEBIAN_FRONTEND=noninteractive sudo apt install -y devscripts build-essential debhelper pkg-config ${{ matrix.job.crossbuild_package }} | ||
mkdir -p debian-build/${{ matrix.job.platform }}/bin | ||
- name: Download binaries | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }} | ||
path: . | ||
|
||
- name: Build package for ${{ matrix.job.platform }} arch | ||
run: | | ||
mv rustdesk-api debian-build/${{ matrix.job.platform }}/bin/ | ||
chmod -v a+x debian-build/${{ matrix.job.platform }}/bin/* | ||
mkdir -p data | ||
cp -vr debian systemd conf data resources runtime debian-build/${{ matrix.job.platform }}/ | ||
cat debian/control.tpl | sed 's/{{ ARCH }}/${{ matrix.job.debian_platform }}/' > debian-build/${{ matrix.job.platform }}/debian/control | ||
cd debian-build/${{ matrix.job.platform }}/ | ||
debuild -i -us -uc -b -a${{ matrix.job.debian_platform}} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: rustdesk-api-${{ matrix.job.debian_platform }} | ||
path: | | ||
debian-build/*.deb | ||
- name: Create Release | ||
if: github.event_name == 'release' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
draft: true | ||
files: | | ||
debian-build/rustdesk-api-server_*_${{ matrix.job.debian_platform }}.deb | ||
docker: | ||
if: false | ||
name: Push Docker Image | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
@@ -235,6 +292,7 @@ jobs: | |
|
||
# | ||
docker-manifest: | ||
if: false | ||
name: Push Docker Manifest | ||
needs: docker | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rustdesk-api-server (1.3.6) UNRELEASED; urgency=medium | ||
|
||
* Update the version to 1.3.6 to match the client. | ||
|
||
-- rustdesk-api <[email protected]> Tue, 24 Dec 2024 13:48:34 +0800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Source: rustdesk-api-server | ||
Section: net | ||
Priority: optional | ||
Maintainer: ymwl <ymwlpoolc@qq.com> | ||
Build-Depends: debhelper (>= 10), pkg-config | ||
Standards-Version: 4.5.0 | ||
Homepage: https://github.com/lejianwen/rustdesk-api/ | ||
|
||
Package: rustdesk-api-server | ||
Architecture: {{ ARCH }} | ||
Depends: systemd ${misc:Depends} | ||
Description: RustDesk api server | ||
RustDesk api server, it is free and open source. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024-present Lejianwen and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/make -f | ||
%: | ||
dh $@ | ||
|
||
override_dh_builddeb: | ||
dh_builddeb -- -Zgzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bin/rustdesk-api usr/bin | ||
systemd/rustdesk-api.service lib/systemd/system | ||
conf var/lib/rustdesk-api | ||
data var/lib/rustdesk-api | ||
resources var/lib/rustdesk-api | ||
runtime var/lib/rustdesk-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
SERVICE=rustdesk-api.service | ||
|
||
if [ "$1" = "configure" ]; then | ||
mkdir -p /var/log/rustdesk-api | ||
fi | ||
|
||
case "$1" in | ||
configure|abort-upgrade|abort-deconfigure|abort-remove) | ||
mkdir -p /var/lib/rustdesk-api/ | ||
deb-systemd-helper unmask "${SERVICE}" >/dev/null || true | ||
if deb-systemd-helper --quiet was-enabled "${SERVICE}"; then | ||
deb-systemd-invoke enable "${SERVICE}" >/dev/null || true | ||
else | ||
deb-systemd-invoke update-state "${SERVICE}" >/dev/null || true | ||
fi | ||
systemctl --system daemon-reload >/dev/null || true | ||
if [ -n "$2" ]; then | ||
deb-systemd-invoke restart "${SERVICE}" >/dev/null || true | ||
else | ||
deb-systemd-invoke start "${SERVICE}" >/dev/null || true | ||
fi | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
SERVICE=rustdesk-api.service | ||
|
||
systemctl --system daemon-reload >/dev/null || true | ||
|
||
if [ "$1" = "purge" ]; then | ||
rm -rf /var/log/rustdesk-api/rustdesk-api.* | ||
deb-systemd-helper purge "${SERVICE}" >/dev/null || true | ||
deb-systemd-helper unmask "${SERVICE}" >/dev/null || true | ||
fi | ||
|
||
if [ "$1" = "remove" ]; then | ||
deb-systemd-helper mask "${SERVICE}" >/dev/null || true | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
SERVICE=rustdesk-api.service | ||
|
||
case "$1" in | ||
remove|deconfigure) | ||
deb-systemd-invoke stop "${SERVICE}" >/dev/null || true | ||
deb-systemd-invoke disable "${SERVICE}" >/dev/null || true | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (native) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Rustdesk api Server | ||
|
||
[Service] | ||
Type=simple | ||
LimitNOFILE=1000000 | ||
ExecStart=/usr/bin/rustdesk-api | ||
WorkingDirectory=/var/lib/rustdesk-api/ | ||
User= | ||
Group= | ||
Restart=always | ||
StandardOutput=append:/var/log/rustdesk-api/rustdesk-api.log | ||
StandardError=append:/var/log/rustdesk-api/rustdesk-api.error | ||
# Restart service after 10 seconds if node service crashes | ||
RestartSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |