diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3654809 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,85 @@ +name: ci + +on: + push: + tags: + - 'v*' + branches: + - main # Set a branch name to trigger deployment + pull_request: + +jobs: + meta: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.set_tag.outputs.tag }} + steps: + - uses: actions/checkout@v3 + - id: set_tag + run: | + echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT + + build: + needs: meta + runs-on: ubuntu-22.04 + permissions: + contents: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Build webpage + run: | + npm ci + npm run build + + - name: Build server + run: | + cd server + npm ci + npm run build + cd .. + + - name: Build Package + run: | + cd server + npx pkg . -t node18-x64-windows + mkdir -p out/web + cp -r web/* out/web/ + mkdir -p out/saves + cd .. + + - uses: actions/upload-artifact@v3 + with: + name: MaaJsonViewer-win + path: 'server/out' + + release: + if: startsWith(github.ref, 'refs/tags/v') + needs: [meta, build] + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v3 + with: + path: assets + + - run: | + cd assets + for f in *; do + (cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .) + done + + - uses: softprops/action-gh-release@v1 + with: + files: assets/*.zip + tag_name: ${{ needs.meta.outputs.tag }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index b3bd04a..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build test - -on: - push: - branches: - - main # Set a branch name to trigger deployment - pull_request: - -jobs: - deploy: - runs-on: ubuntu-22.04 - permissions: - contents: write - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - steps: - - uses: actions/checkout@v3 - with: - submodules: true # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Build webpage - run: | - npm ci - npm run build - - - name: Build server - run: | - cd server - npm ci - npm run build diff --git a/package.json b/package.json index 88a5983..614cc18 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "build-only": "vite build", "build-watch": "vite build --watch", "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", - "backend": "cd server && npm run run" + "backend": "cd server && npm run run", + "build-all": "npm run build && cd server && npm run build" }, "dependencies": { "vue": "^3.3.4" diff --git a/server/package.json b/server/package.json index 1cca3c3..fd8f21a 100644 --- a/server/package.json +++ b/server/package.json @@ -17,11 +17,6 @@ }, "bin": "dist/index.js", "pkg": { - "targets": [ - "node18-win-x64", - "node18-linux-x64", - "node18-macos-x64" - ], "outputPath": "out" } } diff --git a/src/components/SingleNavigateEdit.vue b/src/components/SingleNavigateEdit.vue index 485f4ee..8f66236 100644 --- a/src/components/SingleNavigateEdit.vue +++ b/src/components/SingleNavigateEdit.vue @@ -8,7 +8,6 @@ import { SwipeRightOutlined, TranslateOutlined } from '@vicons/material' -import { taskData } from '@/data' import ImageHover from './ImageHover.vue' import type { UseProducer } from '@/persis' import { getTask, taskIndex } from '@/data/task'