mirror of
https://github.com/booklore-app/booklore.git
synced 2025-12-23 22:28:11 -05:00
Fix tagging
This commit is contained in:
52
.github/workflows/docker-build-publish.yml
vendored
52
.github/workflows/docker-build-publish.yml
vendored
@@ -231,29 +231,34 @@ jobs:
|
|||||||
echo "bump=$bump" >> $GITHUB_ENV
|
echo "bump=$bump" >> $GITHUB_ENV
|
||||||
echo "new_tag=$next_version" >> $GITHUB_ENV
|
echo "new_tag=$next_version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Generate Image Tag
|
||||||
id: meta
|
id: set_image_tag
|
||||||
uses: docker/metadata-action@v5
|
run: |
|
||||||
with:
|
branch="${GITHUB_REF#refs/heads/}"
|
||||||
images: |
|
if [[ "$branch" == "master" ]]; then
|
||||||
booklore/booklore
|
image_tag="${{ env.new_tag }}"
|
||||||
ghcr.io/booklore-app/booklore
|
elif [[ "$branch" == "develop" ]]; then
|
||||||
tags: |
|
short_sha=$(git rev-parse --short HEAD)
|
||||||
type=sha,enable=${{ github.ref != github.event.repository.default_branch }}
|
image_tag="${{ env.latest_tag }}-develop-${short_sha}"
|
||||||
type=raw,value={{branch}}-{{sha_short}},enable=${{ github.ref_name == 'develop' }}
|
else
|
||||||
type=raw,value=${{ env.new_tag }},enable=${{ github.ref_name == 'master' }}
|
short_sha=$(git rev-parse --short HEAD)
|
||||||
type=raw,value=latest,enable=${{ github.ref_name == 'master' }}
|
image_tag="${short_sha}"
|
||||||
|
fi
|
||||||
|
echo "image_tag=$image_tag" >> $GITHUB_ENV
|
||||||
|
echo "Image tag: $image_tag"
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
if: github.event_name == 'push'
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name == 'push' }}
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
booklore/booklore:${{ env.image_tag }}
|
||||||
|
ghcr.io/booklore-app/booklore:${{ env.image_tag }}
|
||||||
build-args: |
|
build-args: |
|
||||||
APP_VERSION=${{ steps.meta.outputs.version }}
|
APP_VERSION=${{ env.image_tag }}
|
||||||
APP_REVISION=${{ github.sha }}
|
APP_REVISION=${{ github.sha }}
|
||||||
cache-from: |
|
cache-from: |
|
||||||
type=gha
|
type=gha
|
||||||
@@ -262,6 +267,21 @@ jobs:
|
|||||||
type=gha,mode=max
|
type=gha,mode=max
|
||||||
type=registry,ref=ghcr.io/booklore-app/booklore:buildcache,mode=max
|
type=registry,ref=ghcr.io/booklore-app/booklore:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: Push Latest Tag (Master Only)
|
||||||
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
booklore/booklore:latest
|
||||||
|
ghcr.io/booklore-app/booklore:latest
|
||||||
|
build-args: |
|
||||||
|
APP_VERSION=${{ env.new_tag }}
|
||||||
|
APP_REVISION=${{ github.sha }}
|
||||||
|
cache-from: type=gha
|
||||||
|
|
||||||
- name: Update GitHub Release Draft (Master Only)
|
- name: Update GitHub Release Draft (Master Only)
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
uses: release-drafter/release-drafter@v6
|
uses: release-drafter/release-drafter@v6
|
||||||
|
|||||||
Reference in New Issue
Block a user