mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-10 15:18:46 +08:00
Update docker-image.yml
This commit is contained in:
12
.github/workflows/docker-image.yml
vendored
12
.github/workflows/docker-image.yml
vendored
@@ -9,10 +9,17 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write # 必须授权以推送镜像
|
||||
env:
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 设置小写镜像名称
|
||||
run: |
|
||||
LOWER_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]')
|
||||
echo "LOWER_NAME=$LOWER_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: 登录到 GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
@@ -26,6 +33,5 @@ jobs:
|
||||
context: .
|
||||
push: ${{ github.event_name == 'push' }} # 仅推送代码时上传镜像
|
||||
tags: |
|
||||
ghcr.io/${{ format('{0}:latest', toLower(github.repository)) }}
|
||||
ghcr.io/${{ format('{0}:{1}', toLower(github.repository), github.sha) }}
|
||||
ghcr.io/${{ format('{0}:{1}', toLower(github.repository), github.ref_name) }}
|
||||
ghcr.io/${{ env.LOWER_NAME }}:latest
|
||||
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}
|
||||
|
||||
Reference in New Issue
Block a user