diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..002c943 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Build and Release + +on: + push: + tags: + - 'v*' + +jobs: + build-and-release: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '22.x' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build for production + run: pnpm build + + - name: Build for file protocol + run: pnpm build:file + + - name: Prepare directories + run: | + mv dist dist-prod + mv dist-prod/index.html dist-prod/404.html + + - name: Create production build archive + run: | + tar -czf dist.tar.gz dist-prod + + - name: Create file protocol build archive + run: | + tar -czf dist-file.tar.gz dist-file + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + dist.tar.gz + dist-file.tar.gz + draft: true + prerelease: false + generate_release_notes: true \ No newline at end of file diff --git a/package.json b/package.json index b196366..f0350b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "log-lottery", "private": true, - "version": "0.0.3", + "version": "0.0.4", "type": "module", "license": "MIT", "scripts": { diff --git a/vite.config.ts b/vite.config.ts index 1d61870..9333016 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -116,6 +116,7 @@ export default defineConfig(({ mode }) => { }, }, build: { + outDir: mode === 'file' ? 'dist-file' : 'dist', // Tauri 在 Windows 上使用 Chromium,在 macOS 和 Linux 上使用 WebKit // target: (process.env.TAURI_ENV_PLATFORM && mode !== 'file') // ? (process.env.TAURI_ENV_PLATFORM === 'windows' ? 'chrome105' : 'safari13')