fix(project): 修复对话框关闭前瞬间显示「未选择」的闪烁问题 #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| env: | |
| NODE_VERSION: "20" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| cache-dependency-path: frontend/pnpm-lock.yaml | |
| - name: Install dependencies | |
| working-directory: frontend | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate sitemap | |
| working-directory: frontend | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y python3 python3-pip | |
| pip3 install requests --break-system-packages | |
| python3 scripts/generate-sitemap.py || true | |
| - name: Build | |
| working-directory: frontend | |
| run: pnpm run build | |
| - name: Upload dist | |
| run: | | |
| mkdir -p _build/dist && cp -r frontend/dist/* _build/dist/ | |
| - name: Upload dist artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: _build/dist/ | |
| docker: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| - name: Prepare docker context | |
| run: | | |
| if [ -d dist ]; then | |
| cp -r dist frontend/docker/ | |
| elif [ -d _build/dist ]; then | |
| cp -r _build/dist frontend/docker/ | |
| else | |
| mkdir -p frontend/docker/dist | |
| for f in index.html assets captcha ppt; do [ -e "$f" ] && cp -r "$f" frontend/docker/dist/; done | |
| cp -r *.ttf *.png *.jpg *.svg *.txt *.js *.wasm frontend/docker/dist/ 2>/dev/null || true | |
| [ -f frontend/docker/dist/index.html ] || (echo "Artifact structure:" && find . -maxdepth 3 -type d && exit 1) | |
| fi | |
| ls -la frontend/docker/dist/ | head -25 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: frontend/docker | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/monkeycode-frontend:${{ github.sha }} | |
| ghcr.io/${{ github.repository_owner }}/monkeycode-frontend:latest | |
| platforms: linux/amd64 |