Add build for Linux desktop app version

pull/309/head
zanllp 2023-07-12 16:04:20 +08:00
parent 3e7fadb439
commit eedaa60893
5 changed files with 59 additions and 20 deletions

View File

@ -9,7 +9,7 @@ jobs:
build:
strategy:
matrix:
os: [windows-latest]
os: [windows-latest,ubuntu-20.04]
runs-on: ${{ matrix.os }}
@ -19,11 +19,15 @@ jobs:
- name: Check-out repository
uses: actions/checkout@v3
- run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> "$GITHUB_ENV"
if: matrix.os == 'ubuntu-20.04'
- run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> $env:GITHUB_ENV
if: matrix.os == 'windows-latest'
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
python-version: '3.10'
cache: 'pip'
cache-dependency-path: |
**/requirements*.txt
@ -40,16 +44,19 @@ jobs:
output-file: iib_api_server
output-dir: out
- name: Upload Artifacts
- name: Upload Server Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }} Build
name: iib_api_server-${{ env.VERSION }}-${{ runner.os }}
path: |
out/*.exe
out/*.bin
out/*.app/**/*
out/iib_api_server.exe
out/iib_api_server
- run: mv out/iib_api_server.exe vue/src-tauri/iib_api_server-x86_64-pc-windows-msvc.exe
if: matrix.os == 'windows-latest'
- run: mv out/iib_api_server vue/src-tauri/iib_api_server-x86_64-unknown-linux-gnu
if: matrix.os == 'ubuntu-20.04'
- name: Install frontend dependencies
run: yarn install
@ -68,27 +75,56 @@ jobs:
with:
workspaces: './vue/src-tauri -> target'
- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
- name: Build the app
run: |
yarn tauri-build
working-directory: vue
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: bundle-${{ env.VERSION }}-${{ runner.os }}
path: |
vue/src-tauri/target/release/bundle/nsis/Infinite Image Browsing_${{ env.VERSION }}_x64-setup.exe
vue/src-tauri/target/release/bundle/deb/infinite-image-browsing_${{ env.VERSION }}_amd64.deb
- name: Extract version and product name
id: extract
run: |
echo "::set-output name=PRODUCT_NAME::$(jq -r '.package.productName' vue/src-tauri/tauri.conf.json)"
echo "::set-output name=VERSION::$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)"
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check-out repository
uses: actions/checkout@v3
- run: echo "VERSION=$(jq -r '.package.version' vue/src-tauri/tauri.conf.json)" >> "$GITHUB_ENV"
- name: Delete drafts
uses: hugo19941994/delete-draft-releases@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: bundle-${{ env.VERSION }}-Windows
path: artifacts
- uses: actions/download-artifact@v3
with:
name: bundle-${{ env.VERSION }}-Linux
path: artifacts
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
tag_name: v${{ steps.extract.outputs.VERSION }}
files: |
vue/src-tauri/target/release/bundle/nsis/${{ steps.extract.outputs.PRODUCT_NAME }}_${{ steps.extract.outputs.VERSION }}_x64-setup.exe
tag_name: v${{ env.VERSION }}
files: artifacts/**/*

3
.gitignore vendored
View File

@ -12,4 +12,5 @@ standalone.cmd
build/**/*
dist/**/*
*.spec
out/**/*
out/**/*
venv/**/*

View File

@ -2,4 +2,5 @@
# will have compiled files and executables
/target/
app.conf.json
iib_api_server-x86_64-pc-windows-msvc.exe
iib_api_server-x86_64-pc-windows-msvc.exe
iib_api_server-x86_64-unknown-linux-gnu

View File

@ -53,6 +53,7 @@ fn shutdown_api_server_command(state: tauri::State<'_, AppState>) {
fn main() {
let listener = std::net::TcpListener::bind("localhost:0").expect("无法绑定到任何可用端口");
let port = listener.local_addr().unwrap().port();
drop(listener);
let port_str = port.to_string();
let mut args = vec!["--port", &port_str, "--allow_cors", "--enable_shutdown"];
let contents = read_config_file("app.conf.json").unwrap_or_default();

View File

@ -8,7 +8,7 @@
},
"package": {
"productName": "Infinite Image Browsing",
"version": "0.0.1"
"version": "0.1.0"
},
"tauri": {
"allowlist": {
@ -54,7 +54,7 @@
"fullscreen": false,
"resizable": true,
"fileDropEnabled": false,
"title": "tauri-app",
"title": "Infinite Image Browsing",
"width": 800,
"height": 600,
"maximized": true