diff --git a/.github/workflows/build_native.yml b/.github/workflows/build_native.yml new file mode 100644 index 0000000..a59a2cf --- /dev/null +++ b/.github/workflows/build_native.yml @@ -0,0 +1,52 @@ +name: build_native + +on: + push: + branches: + - release + +jobs: + publish-tauri: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-20.04, windows-latest] + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v3 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 7.x.x + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install frontend dependencies + run: pnpm i --no-frozen-lockfile + + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + projectPath: ./native + tagName: native-v__VERSION__ + releaseName: 'Native v__VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: false + prerelease: false diff --git a/native/package.json b/native/package.json index c53c0b0..3a52697 100644 --- a/native/package.json +++ b/native/package.json @@ -8,5 +8,8 @@ }, "keywords": [], "author": "", - "license": "ISC" + "license": "ISC", + "devDependencies": { + "cross-env": "^7.0.3" + } } diff --git a/native/src-tauri/tauri.conf.json b/native/src-tauri/tauri.conf.json index 12b5052..49cbdeb 100644 --- a/native/src-tauri/tauri.conf.json +++ b/native/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "build": { - "beforeBuildCommand": "VITE_SYNC_API=\"https://be.icelava.top:49374/NyaDict\" pnpm -F nyadict-frontend build", + "beforeBuildCommand": "pnpm cross-env VITE_SYNC_API=\"https://be.icelava.top:49374/NyaDict\" pnpm -F nyadict-frontend build", "beforeDevCommand": "pnpm -F nyadict-frontend dev", "devPath": "http://localhost:1635", "distDir": "../../frontend/dist" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 79df155..fe88e09 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -193,7 +193,11 @@ importers: specifier: ^5.1.3 version: 5.1.3 - native: {} + native: + devDependencies: + cross-env: + specifier: ^7.0.3 + version: 7.0.3 packages: @@ -1881,6 +1885,14 @@ packages: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} dev: true + /cross-env@7.0.3: + resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} + engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} + hasBin: true + dependencies: + cross-spawn: 7.0.3 + dev: true + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'}