Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/prod-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Release Production

on:
push:
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-prod-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest

- uses: docker/setup-buildx-action@v3

- uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
Comment on lines +1 to +47

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

This file is in the wrong location and will never run.

GitHub Actions only discovers workflows under .github/workflows/. A file at .github/prod-cd.yml is inert — it will not trigger on tag pushes despite the on: push: tags block. Given .github/workflows/prod-cd.yml already exists in this PR, please delete this file and instead merge its extra steps (buildx setup, platforms: linux/amd64,linux/arm64, gha cache) into .github/workflows/prod-cd.yml, otherwise the multi-arch and caching configuration that appears to be the whole point of this file is silently lost.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/prod-cd.yml around lines 1 - 47, The workflow defined as "Build and
Release Production" contains a misplaced file that will not be executed; delete
the redundant inactive workflow file and merge its important build steps into
the existing prod-cd workflow: copy the build-job "build-prod-image" additions
(docker/setup-buildx-action@v3 step, the docker/build-push-action@v5 fields
platforms: linux/amd64,linux/arm64 and cache-from/cache-to settings, and any
meta step tags/labels usage) into the active prod-cd workflow so the multi-arch
build and GHA cache configuration are preserved, then remove the inactive file
to avoid duplication.

37 changes: 37 additions & 0 deletions .github/test-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/test-ci.yml
name: Build for Test Environment

on:
push:
branches:
- prod # 只监听 prod 分支的变更

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-test-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Test Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
# 固定打上 test 标签,供测试服务器拉取
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
Comment on lines +1 to +37

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

This file is in the wrong location and will never run.

Same issue as .github/prod-cd.yml: GitHub Actions only picks up workflow YAML under .github/workflows/. This file at .github/test-ci.yml is a no-op. The functionally identical .github/workflows/test-ci.yml already covers this trigger, so please delete this duplicate to prevent future maintainers from editing the inert copy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/test-ci.yml around lines 1 - 37, The file containing the workflow
named "Build for Test Environment" with job "build-test-image" is a duplicate
and inert (GitHub only runs workflows placed in the workflows directory); delete
this duplicate workflow file (the one defining the "Build for Test Environment"
workflow and "build-test-image" job) from the repo so maintainers won't edit a
non-running copy, and verify the functional workflow remains in the active
workflows location.

179 changes: 0 additions & 179 deletions .github/workflows/docker-image-alpha.yml

This file was deleted.

Loading
Loading