chore: improve tags with docker/metadata action
parent
c44a9c7195
commit
26fc0e7e64
|
|
@ -53,17 +53,26 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
|
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
|
||||||
|
|
||||||
- name: Generate tag name
|
|
||||||
env:
|
|
||||||
REF_NAME: ${{ github.ref_name }}
|
|
||||||
run: |
|
|
||||||
echo "TAG_NAME=$(echo $REF_NAME | sed 's/main/nightly/g' | sed 's/^v//g')" >>${GITHUB_ENV}
|
|
||||||
|
|
||||||
- uses: int128/docker-build-cache-config-action@v1
|
- uses: int128/docker-build-cache-config-action@v1
|
||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
image: ghcr.io/${{ env.IMAGE_NAME }}/cache
|
image: ghcr.io/${{ env.IMAGE_NAME }}/cache
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ env.IMAGE_NAME }}
|
||||||
|
${{ env.IMAGE_NAME }}
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule,pattern=nightly
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
||||||
|
type=match,pattern=^v\d+.\d+.\d+$,value=latest
|
||||||
|
type=match,pattern=v(.*)
|
||||||
|
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
|
@ -73,9 +82,7 @@ jobs:
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
context: .
|
context: .
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
|
|
||||||
${{ env.IMAGE_NAME }}:${{ env.TAG_NAME }}
|
|
||||||
cache-from: ${{ steps.cache.outputs.cache-from }}
|
cache-from: ${{ steps.cache.outputs.cache-from }}
|
||||||
cache-to: ${{ steps.cache.outputs.cache-to }}
|
cache-to: ${{ steps.cache.outputs.cache-to }}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue