feat: 支持 Proton Authenticator 数据导出,引入 fast-xml-parser 彻底重构 S3 解析逻辑,优化… #41
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 Docker images" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| name: "Build and push Docker images" | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Inject Commit Hash & Platform | |
| run: | | |
| SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7) | |
| echo "Injecting Public SHA: $SHORT_SHA (Platform: Docker)" | |
| # 1. Backend Injection | |
| sed -i "s/__DIST_COMMIT_HASH__/$SHORT_SHA/g" backend/dist/server.js || true | |
| sed -i "s/__DIST_COMMIT_HASH__/$SHORT_SHA/g" backend/dist/worker.js || true | |
| sed -i "s/__DIST_PLATFORM__/Docker/g" backend/dist/server.js || true | |
| # 2. Frontend Injection: Icons & Manifest | |
| sed -i "s/__DIST_ICON_SUFFIX__/docker/g" frontend/dist/index.html || true | |
| sed -i "s/__DIST_ICON_SUFFIX__/docker/g" frontend/dist/manifest.webmanifest || true | |
| find frontend/dist -name "*.js" -exec sed -i "s/__DIST_ICON_SUFFIX__/docker/g" {} + || true | |
| # 3. Frontend Injection: Version & Platform Info | |
| find frontend/dist -type f \( -name "*.js" -o -name "*.html" \) -exec sed -i "s/__DIST_COMMIT_HASH__/$SHORT_SHA/g" {} + || true | |
| find frontend/dist -type f \( -name "*.js" -o -name "*.html" \) -exec sed -i "s/__DIST_PLATFORM__/Docker/g" {} + || true | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Push images to Docker hub | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |