feat: enhance image loading component with referrer policy and eager … #84
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: Deploy StaticFlow Frontend (Production) | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: # 允许手动触发 | |
| permissions: | |
| contents: write | |
| pages: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Install Trunk 0.21.14 | |
| run: | | |
| curl -L https://github.com/trunk-rs/trunk/releases/download/v0.21.14/trunk-x86_64-unknown-linux-musl.tar.gz -o trunk.tar.gz | |
| tar -xzf trunk.tar.gz | |
| chmod +x trunk | |
| sudo mv trunk /usr/local/bin/trunk | |
| trunk --version | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install npm dependencies | |
| working-directory: frontend | |
| run: npm install | |
| - name: Install wasm-opt (from binaryen) | |
| run: | | |
| wget https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz | |
| tar -xzf binaryen-version_116-x86_64-linux.tar.gz | |
| mkdir -p ~/.cache/trunk/wasm-opt-version_116/bin | |
| cp binaryen-version_116/bin/wasm-opt ~/.cache/trunk/wasm-opt-version_116/bin/ | |
| chmod +x ~/.cache/trunk/wasm-opt-version_116/bin/wasm-opt | |
| ~/.cache/trunk/wasm-opt-version_116/bin/wasm-opt --version | |
| - name: Build frontend (production) | |
| working-directory: frontend | |
| run: trunk build --release | |
| env: | |
| STATICFLOW_API_BASE: ${{ vars.STATICFLOW_API_BASE }} | |
| TRUNK_SKIP_VERSION_CHECK: "true" | |
| - name: Copy 404.html to dist root (GitHub Pages SPA routing) | |
| working-directory: frontend | |
| run: cp 404.html dist/404.html | |
| - name: Copy standalone pages to dist | |
| working-directory: frontend | |
| run: | | |
| if [ -d "standalone" ] && [ "$(ls -A standalone 2>/dev/null)" ]; then | |
| cp -r standalone dist/ | |
| echo "Copied standalone pages to dist/standalone/" | |
| else | |
| echo "No standalone pages found, skipping" | |
| fi | |
| - name: Deploy to User Pages (acking-you.github.io) | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| personal_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| external_repository: acking-you/acking-you.github.io | |
| publish_dir: frontend/dist | |
| publish_branch: master | |
| force_orphan: true |