Update buidl_and_push_ghcr.yml
This commit is contained in:
16
.github/workflows/buidl_and_push_ghcr.yml
vendored
16
.github/workflows/buidl_and_push_ghcr.yml
vendored
@@ -1,6 +1,5 @@
|
|||||||
name: Docker Image CI
|
name: Docker Image CI
|
||||||
|
|
||||||
# 触发条件改为手动
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # 手动触发
|
workflow_dispatch: # 手动触发
|
||||||
|
|
||||||
@@ -20,16 +19,15 @@ jobs:
|
|||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }} # 你的 GitHub 用户名
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# 构建并推送 Docker 镜像,设置两个 tag
|
# 构建并推送 Docker 镜像,使用个人命名空间
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
run: |
|
run: |
|
||||||
# 构建镜像并打上两个 tag
|
# 使用 github.actor 作为命名空间,确保是个人账户
|
||||||
docker build . --file Dockerfile \
|
docker build . --file Dockerfile \
|
||||||
--tag ghcr.io/${{ github.repository }}/my-image-name:latest \
|
--tag ghcr.io/${{ github.actor }}/my-docs:latest \
|
||||||
--tag ghcr.io/${{ github.repository }}/my-image-name:${{ github.sha }}
|
--tag ghcr.io/${{ github.actor }}/my-docs:${{ github.sha }}
|
||||||
# 推送两个 tag
|
docker push ghcr.io/${{ github.actor }}/my-docs:latest
|
||||||
docker push ghcr.io/${{ github.repository }}/my-image-name:latest
|
docker push ghcr.io/${{ github.actor }}/my-docs:${{ github.sha }}
|
||||||
docker push ghcr.io/${{ github.repository }}/my-image-name:${{ github.sha }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user