Skip to content

Commit 3815c6b

Browse files
committed
✏️ [release prod] Add a checking process of the project has Dockerfile or not and only run the Docker relative processes if it has.
1 parent ec7e813 commit 3815c6b

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

.github/workflows/rw_release_complete.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ on:
5555
value: ${{ jobs.intent.outputs.python != 'skip' && jobs.intent.outputs.do_release == 'true' }}
5656
docker_released:
5757
description: 'Whether Docker images were released'
58-
value: ${{ jobs.intent.outputs.docker != 'skip' && jobs.intent.outputs.do_release == 'true' }}
58+
value: ${{ jobs.check-dockerfile.outputs.has_dockerfile == 'true' && jobs.intent.outputs.docker != 'skip' && jobs.intent.outputs.do_release == 'true' }}
5959
docs_released:
6060
description: 'Whether documentation was versioned'
6161
value: ${{ jobs.prepare_docs_matrix.outputs.has_sections == 'true' && jobs.intent.outputs.do_release == 'true' }}
@@ -71,6 +71,26 @@ jobs:
7171
name: Parse Configuration
7272
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
7373

74+
check-dockerfile:
75+
name: Check Dockerfile Exists
76+
runs-on: ubuntu-latest
77+
outputs:
78+
has_dockerfile: ${{ steps.check.outputs.has_dockerfile }}
79+
steps:
80+
- name: Checkout repository
81+
uses: actions/checkout@v5
82+
83+
- name: Check for Dockerfile
84+
id: check
85+
run: |
86+
if [ -f "Dockerfile" ]; then
87+
echo "✅ Dockerfile found"
88+
echo "has_dockerfile=true" >> $GITHUB_OUTPUT
89+
else
90+
echo "⚠️ No Dockerfile found - Docker processes will be skipped"
91+
echo "has_dockerfile=false" >> $GITHUB_OUTPUT
92+
fi
93+
7494
intent:
7595
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_release_intent.yaml@master
7696
needs: config
@@ -376,8 +396,8 @@ jobs:
376396
release_docker_hub:
377397
name: Release to DockerHub
378398
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
379-
needs: [config, intent, bump_version, build_git-tag_and_create_github-release]
380-
if: needs.intent.outputs.do_release == 'true' && needs.intent.outputs.docker != 'skip'
399+
needs: [config, check-dockerfile, intent, bump_version, build_git-tag_and_create_github-release]
400+
if: needs.check-dockerfile.outputs.has_dockerfile == 'true' && needs.intent.outputs.do_release == 'true' && needs.intent.outputs.docker != 'skip'
381401
secrets:
382402
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }}
383403
registry-token: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -393,8 +413,8 @@ jobs:
393413
release_docker_ghcr:
394414
name: Release to GHCR
395415
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_docker_operations.yaml@master
396-
needs: [config, intent, bump_version, build_git-tag_and_create_github-release]
397-
if: needs.intent.outputs.do_release == 'true' && needs.intent.outputs.docker != 'skip'
416+
needs: [config, check-dockerfile, intent, bump_version, build_git-tag_and_create_github-release]
417+
if: needs.check-dockerfile.outputs.has_dockerfile == 'true' && needs.intent.outputs.do_release == 'true' && needs.intent.outputs.docker != 'skip'
398418
with:
399419
operation: 'push'
400420
registry: ${{ needs.config.outputs.docker_registry_ghcr }}

0 commit comments

Comments
 (0)