Skip to content

Commit

Permalink
Push Docker image on release or manual build (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru authored May 24, 2024
1 parent 838ea9e commit e51e263
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [opened, synchronize, reopened]
release:
types:
- created
- published
schedule:
- cron: '30 23 * * *'

Expand All @@ -17,7 +17,7 @@ jobs:
- name: "Checkout source code at current commit"
uses: actions/checkout@v4
- name: Prepare tags for Docker image
if: (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'schedule'
if: (github.event_name == 'release' && github.event.action == 'published') || github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
id: prepare
run: |
TAGS=${{ github.repository }}:sha-${GITHUB_SHA:0:7}
Expand All @@ -34,12 +34,14 @@ jobs:
fi
if [[ ${{ github.event_name }} == 'schedule' ]]; then
TAGS="$TAGS,${{ github.repository }}:latest,${{ github.repository }}:nightly"
elif [[ $GITHUB_REF != refs/pull/* ]]; then
TAGS="$TAGS,${{ github.repository }}:latest"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'schedule'
if: (github.event_name == 'release' && github.event.action == 'published') || github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -48,5 +50,5 @@ jobs:
id: docker_build
uses: docker/build-push-action@v5
with:
push: ${{ (github.event_name == 'release' && github.event.action == 'created') || github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'schedule' }}
push: ${{ (github.event_name == 'release' && github.event.action == 'published') || github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
tags: ${{ steps.prepare.outputs.tags }}

0 comments on commit e51e263

Please sign in to comment.