fix(docs): 修正公安备案链接地址错误 #5
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: CI Pipeline, To GitHub Container Registry | |
| on: | |
| # 2个 CI 流水线触发方式 | |
| workflow_dispatch: # 手动点击 | |
| push: # 推送分支 release | |
| branches: | |
| - 'release' | |
| - 'main' | |
| # 定义环境变量 | |
| env: | |
| REGISTRY: ghcr.io # GitHub Container Registry | |
| IMAGE_NAME: ${{ github.repository }} # 系统环境变量,所在 GitHub 仓库名 | |
| jobs: | |
| build-and-push-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| # 3个仓库相关变量,用户无需关注 | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| # 构建镜像,并推送到 ghcr.io | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| id: push | |
| with: | |
| context: . # 构建上下文,默认为项目更目录下的 Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # 生成项目证明 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: true | |
| # 发送邮件到 QQ 邮箱 | |
| - name: Send email notification | |
| uses: dawidd6/action-send-mail@v3 | |
| with: | |
| server_address: smtp.qq.com | |
| server_port: 465 | |
| secure: true | |
| username: ${{ secrets.MAIL_USERNAME }} # 用户关注,QQ 邮箱账号,例:12345678@qq.com | |
| password: ${{ secrets.MAIL_PASSWORD }} # 用户关注,QQ 邮箱授权码(非登录密码) | |
| subject: "🐳 镜像构建完成 - ${{ github.repository }}" | |
| to: xing.xiaolin@foxmail.com # 目标邮箱 | |
| from: GitHub Actions | |
| html_body: | | |
| <h2>镜像构建与证明生成完成</h2> | |
| <p><strong>仓库:</strong>${{ github.repository }}</p> | |
| <p><strong>分支:</strong>${{ github.ref_name }}</p> | |
| <p><strong>提交:</strong>${{ github.sha }}</p> | |
| <p><strong>镜像:</strong>${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}</p> | |
| <p><strong>标签:</strong>${{ steps.meta.outputs.tags }}</p> | |
| <p><strong>摘要:</strong>${{ steps.push.outputs.digest }}</p> | |
| <p><strong>证明状态:</strong>✅ 已生成并推送至 ghcr.io</p> | |
| <hr> | |
| <p><small>此邮件由 GitHub Actions 自动发送</small></p> | |