diff --git a/.github/workflows/tauri_app_build.yml b/.github/workflows/tauri_app_build.yml index 6f2bc34..4a9494f 100644 --- a/.github/workflows/tauri_app_build.yml +++ b/.github/workflows/tauri_app_build.yml @@ -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/**/* diff --git a/.gitignore b/.gitignore index d44b8ba..1be7b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ standalone.cmd build/**/* dist/**/* *.spec -out/**/* \ No newline at end of file +out/**/* +venv/**/* \ No newline at end of file diff --git a/vue/src-tauri/.gitignore b/vue/src-tauri/.gitignore index a9c2b42..af35221 100644 --- a/vue/src-tauri/.gitignore +++ b/vue/src-tauri/.gitignore @@ -2,4 +2,5 @@ # will have compiled files and executables /target/ app.conf.json -iib_api_server-x86_64-pc-windows-msvc.exe \ No newline at end of file +iib_api_server-x86_64-pc-windows-msvc.exe +iib_api_server-x86_64-unknown-linux-gnu \ No newline at end of file diff --git a/vue/src-tauri/src/main.rs b/vue/src-tauri/src/main.rs index 4435ba0..d157c62 100644 --- a/vue/src-tauri/src/main.rs +++ b/vue/src-tauri/src/main.rs @@ -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(); diff --git a/vue/src-tauri/tauri.conf.json b/vue/src-tauri/tauri.conf.json index 41691f7..e910ac0 100644 --- a/vue/src-tauri/tauri.conf.json +++ b/vue/src-tauri/tauri.conf.json @@ -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