fix: description in bilibili search message gets truncated #13
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 Container Image to GHCR | |
| # 1. 定义触发工作流的事件 | |
| # 当有代码推送到 main 分支时触发 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| # 2. 定义环境变量,方便后续引用 | |
| env: | |
| # ghcr.io 上的镜像名称 | |
| # 格式为:ghcr.io/OWNER/REPO_NAME | |
| IMAGE_NAME: ghcr.io/blockg-ws/${{ github.event.repository.name }} | |
| # 3. 定义工作流中的任务 | |
| jobs: | |
| build-and-push: | |
| # 指定运行环境 | |
| runs-on: ubuntu-latest | |
| # 授予工作流写入 GitHub Packages 的权限 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| # 第一步:检出代码 | |
| # 使用 actions/checkout 拉取你的项目代码 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 第二步:登录到 GitHub Container Registry (ghcr.io) | |
| # 使用 docker/login-action 登录 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| # github.actor 是触发工作流的用户名 | |
| username: ${{ github.actor }} | |
| # GITHUB_TOKEN 是一个由 GitHub Actions 自动生成的密钥,用于授权 | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # 第三步:构建并推送 Docker 镜像 | |
| # 使用 docker/build-push-action 来完成构建和推送 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . # Dockerfile 的上下文路径,. 代表项目根目录 | |
| file: ./Dockerfile # Dockerfile 的路径 | |
| push: true # 推送到镜像仓库 | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:latest | |
| ${{ env.IMAGE_NAME }}:${{ github.sha }} |