Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,38 @@ jobs:
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Current version: $VERSION"

- name: Check if version tag exists on Docker Hub
id: check_version
run: |
if docker manifest inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.version.outputs.version }} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Version ${{ steps.version.outputs.version }} already exists, skipping push"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Version ${{ steps.version.outputs.version }} is new, will push"
fi

- name: Set up Docker Buildx
if: steps.check_version.outputs.exists == 'false' || github.event_name == 'pull_request'
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && steps.check_version.outputs.exists == 'false'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
if: github.event_name != 'pull_request' && steps.check_version.outputs.exists == 'false'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
if: steps.check_version.outputs.exists == 'false' || github.event_name == 'pull_request'
id: meta
uses: docker/metadata-action@v5
with:
Expand All @@ -67,9 +80,9 @@ jobs:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ steps.version.outputs.version }}
type=sha,prefix=

- name: Build and push
if: steps.check_version.outputs.exists == 'false' || github.event_name == 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1