mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-11 07:38:45 +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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write # 必须授权以推送镜像
|
packages: write # 必须授权以推送镜像
|
||||||
|
env:
|
||||||
|
REPO_NAME: ${{ github.repository }}
|
||||||
steps:
|
steps:
|
||||||
- name: 检出代码
|
- name: 检出代码
|
||||||
uses: actions/checkout@v4
|
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
|
- name: 登录到 GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -26,6 +33,5 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name == 'push' }} # 仅推送代码时上传镜像
|
push: ${{ github.event_name == 'push' }} # 仅推送代码时上传镜像
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ format('{0}:latest', toLower(github.repository)) }}
|
ghcr.io/${{ env.LOWER_NAME }}:latest
|
||||||
ghcr.io/${{ format('{0}:{1}', toLower(github.repository), github.sha) }}
|
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}
|
||||||
ghcr.io/${{ format('{0}:{1}', toLower(github.repository), github.ref_name) }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user