Skip to content

Commit 39e6900

Browse files
committed
Run image publish on main pushes
1 parent 797d8a4 commit 39e6900

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
name: Build and Push Images
22

33
"on":
4-
workflow_dispatch:
5-
inputs:
6-
image_tag:
7-
description: "Docker image tag to publish"
8-
required: true
9-
default: "latest"
4+
push:
5+
branches:
6+
- main
107

118
permissions:
129
contents: read
@@ -50,14 +47,12 @@ jobs:
5047
REGISTRY: ${{ secrets.ALIYUN_REGISTRY }}
5148
NAMESPACE: ${{ secrets.ALIYUN_NAME_SPACE }}
5249
IMAGE: ${{ matrix.image }}
53-
IMAGE_TAG: ${{ inputs.image_tag }}
5450
run: |
5551
set -euo pipefail
56-
VERSION="${IMAGE_TAG:-latest}"
5752
5853
{
5954
echo "tags<<EOF"
60-
echo "${REGISTRY}/${NAMESPACE}/${IMAGE}:${VERSION}"
55+
echo "${REGISTRY}/${NAMESPACE}/${IMAGE}:latest"
6156
echo "EOF"
6257
} >> "$GITHUB_OUTPUT"
6358

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ sudo docker compose up -d
167167
| `ALIYUN_REGISTRY_USER` | 仓库用户名 |
168168
| `ALIYUN_REGISTRY_PASSWORD` | 仓库密码或访问凭证 |
169169

170-
手工运行 `Build and Push Images`填写镜像 tag。`.env` 中的 `IMAGE_TAG` 要和推送的 tag 一致
170+
提交到 `main` 后会自动运行 `Build and Push Images`并把本项目镜像推送为 `latest`。默认 `.env` 中的 `IMAGE_TAG=latest` 可直接匹配该发布流程
171171

172172
## 开发
173173

0 commit comments

Comments
 (0)