Skip to content

Commit bab5c60

Browse files
refactor: Simplify GitHub Actions workflow for Docker image
1 parent 303fb7c commit bab5c60

1 file changed

Lines changed: 11 additions & 22 deletions

File tree

.github/workflows/github.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
1-
name: Build and Push Docker Image to GitHub Container Registry
2-
1+
name: Build and Push
32
on:
43
push:
54
branches:
65
- main
7-
6+
permissions:
7+
packages: write
8+
id-token: write
89
jobs:
910
build:
10-
runs-on: ubuntu-latest
11-
permissions:
12-
contents: read
13-
packages: write
14-
id-token: write
15-
11+
runs-on: ubuntu-latest
1612
steps:
17-
# 检出代码
1813
- name: Checkout code
1914
uses: actions/checkout@v3
20-
21-
# 设置 Docker Buildx
2215
- name: Set up Docker Buildx
2316
uses: docker/setup-buildx-action@v2
24-
25-
# 登录到 GitHub Container Registry
2617
- name: Login to GitHub Container Registry
2718
uses: docker/login-action@v2
2819
with:
2920
registry: ghcr.io
30-
username: ${{ github.actor }} # GitHub 用户名
31-
password: ${{ secrets.GITHUB_TOKEN }} # GitHub 自动生成的令牌
32-
33-
# 构建并推送 Docker 镜像
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
3423
- name: Build and push Docker image to GitHub Container Registry
3524
uses: docker/build-push-action@v3
3625
with:
37-
context: . # 当前目录作为构建上下文
38-
file: ./Dockerfile # Dockerfile 路径
39-
push: true # 推送镜像
40-
tags: ghcr.io/inknight-dednet/comfy_container_ui:latest # 镜像推送到 GitHub 包注册表
26+
context: .
27+
file: ./Dockerfile
28+
push: true
29+
tags: ghcr.io/inknight-dednet/comfy_container_ui:latest

0 commit comments

Comments
 (0)