mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-13 08:00:49 +08:00
新增发布标签工作流并重命名构建工作流为发布夜间版本
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
name: Build Docker Image
|
||||
name: Release Nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
DOCKER_IMAGE_NAME: yanhao98/docker-example
|
||||
GHCR_IMAGE_NAME: ${{ github.repository }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GHCR_USERNAME: ${{ github.repository_owner }}
|
||||
|
||||
@ -19,13 +18,6 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# - name: Login to DockerHub
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: docker.io
|
||||
# username: ${{ env.DOCKER_USERNAME }}
|
||||
# password: ${{ env.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@ -39,21 +31,11 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Cache Docker layers
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: |
|
||||
# /tmp/.buildx-cache
|
||||
# key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-buildx-
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
# docker.io/${{ env.DOCKER_IMAGE_NAME }}
|
||||
ghcr.io/${{ env.GHCR_IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
|
||||
@ -84,6 +66,4 @@ jobs:
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
file: ./Dockerfile
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
# cache-from: type=local,src=/tmp/.buildx-cache
|
||||
# cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
cache-to: type=gha,mode=max
|
Reference in New Issue
Block a user