177 lines
5.7 KiB
YAML
177 lines
5.7 KiB
YAML
name: Build Lotus Chat Desktop
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Get version
|
|
id: version
|
|
shell: powershell
|
|
run: |
|
|
$v = (Get-Content src-tauri\tauri.conf.json | ConvertFrom-Json).version
|
|
"version=$v" >> $env:GITHUB_OUTPUT
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- name: Install frontend deps
|
|
shell: powershell
|
|
run: cd cinny; npm ci
|
|
|
|
- name: Install Tauri deps
|
|
shell: powershell
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
shell: powershell
|
|
env:
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
run: npm run tauri -- build
|
|
|
|
- name: Stage artifacts
|
|
shell: powershell
|
|
run: |
|
|
$v = "${{ steps.version.outputs.version }}"
|
|
New-Item -ItemType Directory -Force dist | Out-Null
|
|
$msi = "src-tauri\target\release\bundle\msi"
|
|
Copy-Item "$msi\Cinny_${v}_x64_en-US.msi" dist\LotusChat-x86_64.msi
|
|
Copy-Item "$msi\Cinny_${v}_x64_en-US.msi.zip" dist\LotusChat-x86_64.msi.zip
|
|
Copy-Item "$msi\Cinny_${v}_x64_en-US.msi.zip.sig" dist\LotusChat-x86_64.msi.zip.sig
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: windows
|
|
path: dist/
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .node-version
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
echo "version=$(python3 -c "import json; print(json.load(open('src-tauri/tauri.conf.json'))['version'])")" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install system deps
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y \
|
|
curl wget file \
|
|
libwebkit2gtk-4.1-dev \
|
|
libssl-dev \
|
|
libxdo-dev \
|
|
libayatana-appindicator3-dev \
|
|
librsvg2-dev \
|
|
patchelf
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- name: Install frontend deps
|
|
run: cd cinny && npm ci
|
|
|
|
- name: Install Tauri deps
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
env:
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
|
NODE_OPTIONS: '--max_old_space_size=4096'
|
|
run: npm run tauri -- build
|
|
|
|
- name: Stage artifacts
|
|
run: |
|
|
v="${{ steps.version.outputs.version }}"
|
|
mkdir dist
|
|
cp "src-tauri/target/release/bundle/deb/Cinny_${v}_amd64.deb" dist/LotusChat-x86_64.deb
|
|
cp "src-tauri/target/release/bundle/appimage/Cinny_${v}_amd64.AppImage" dist/LotusChat-x86_64.AppImage
|
|
cp "src-tauri/target/release/bundle/appimage/Cinny_${v}_amd64.AppImage.tar.gz" dist/LotusChat-x86_64.AppImage.tar.gz
|
|
cp "src-tauri/target/release/bundle/appimage/Cinny_${v}_amd64.AppImage.tar.gz.sig" dist/LotusChat-x86_64.AppImage.tar.gz.sig
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: linux
|
|
path: dist/
|
|
|
|
publish:
|
|
needs: [build-windows, build-linux]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GITEA_URL: https://code.lotusguild.org
|
|
REPO: LotusGuild/cinny-desktop
|
|
steps:
|
|
- name: Install deps
|
|
run: apt-get update && apt-get install -y curl python3
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: windows
|
|
path: dist/
|
|
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: linux
|
|
path: dist/
|
|
|
|
- name: Publish rolling latest release
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
VERSION: ${{ needs.build-windows.outputs.version }}
|
|
run: |
|
|
# Delete existing 'latest' release+tag if present
|
|
OLD_ID=$(curl -sf "$GITEA_URL/api/v1/repos/$REPO/releases/tags/latest" \
|
|
-H "Authorization: token $TOKEN" \
|
|
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
|
|
if [ -n "$OLD_ID" ] && [ "$OLD_ID" != "None" ] && [ "$OLD_ID" != "" ]; then
|
|
curl -sf -X DELETE "$GITEA_URL/api/v1/repos/$REPO/releases/$OLD_ID" \
|
|
-H "Authorization: token $TOKEN"
|
|
curl -f -X DELETE "$GITEA_URL/api/v1/repos/$REPO/tags/latest" \
|
|
-H "Authorization: token $TOKEN" || true
|
|
fi
|
|
|
|
# Create fresh release
|
|
RELEASE_ID=$(curl -sf -X POST "$GITEA_URL/api/v1/repos/$REPO/releases" \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"latest\",\"name\":\"Lotus Chat $VERSION\",\"prerelease\":true,\"body\":\"Built from ${{ github.sha }}\"}" \
|
|
| python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
|
|
|
# Upload all artifacts
|
|
for f in dist/*; do
|
|
[ -f "$f" ] || continue
|
|
fname=$(basename "$f")
|
|
echo "Uploading $fname"
|
|
curl -sf -X POST \
|
|
"$GITEA_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=$fname" \
|
|
-H "Authorization: token $TOKEN" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @"$f"
|
|
done
|