feat(identity): 昵称跟 visitor_id 关联——本地持久 + 服务端预填 #35
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 & Publish Image | |
| on: | |
| push: | |
| branches: [main] | |
| # 文档 / license 改动不该烧 5 分钟多架构构建 | |
| paths-ignore: | |
| - '**.md' | |
| - 'LICENSE' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # 新 push 自动掐掉前面在跑的——25 分钟的多架构构建排队等很烦, | |
| # 而且我们极少需要中间 commit 的 :sha-xxxxxxx 单独镜像。如果将来 | |
| # 要回滚到某个 commit 单独构建,手动用 workflow_dispatch 触发一 | |
| # 下就行 | |
| cancel-in-progress: true | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # QEMU 让单台 amd64 runner 能交叉编 arm64 层。比原生 arm64 慢, | |
| # 但免费档够用,多花点构建时间换不用维护多个 runner pool。 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # :latest 给部署命令固定指,:sha-<short> 给回滚和 bisect 用 | |
| - id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest | |
| type=sha,format=short | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # GHA 缓存按 ref 隔离——同一分支多次 push 共享层缓存, | |
| # 不同分支之间不会互相覆盖 | |
| cache-from: type=gha,scope=${{ github.ref_name }} | |
| cache-to: type=gha,mode=max,scope=${{ github.ref_name }} | |
| # inf-fingerprint 限流豁免 key——build-arg 方式注入,仓库 | |
| # 代码不见 key。Dockerfile 里 frontend-builder 把它转成 | |
| # VITE_INF_FP_API_KEY 环境变量喂给 vite build | |
| build-args: | | |
| INF_FP_API_KEY=${{ secrets.INF_FP_API_KEY }} |