Skip to content

Commit db01936

Browse files
ci: deploy only when workflow_dispatch
1 parent 7337234 commit db01936

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ on:
44
push:
55
pull_request:
66
types: [opened, reopened, synchronize]
7+
workflow_dispatch:
8+
inputs:
9+
push_to_dockerhub:
10+
description: 'Push to Docker Hub'
11+
required: false
12+
default: 'false'
13+
type: boolean
714

815
jobs:
916
build:
@@ -30,14 +37,14 @@ jobs:
3037
docker tag opensourcecobol/opensourcecobol4j:"$version_string_prefix"-debug opensourcecobol/opensourcecobol4j:"$version_string_prefix"-debug-latest
3138
3239
- name: Login to Docker Hub
33-
if: github.ref == 'refs/heads/y-sakamoto/auto-deploy' && github.event_name == 'push'
40+
if: github.ref == 'main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true'
3441
uses: docker/login-action@v3
3542
with:
3643
username: ${{ secrets.DOCKERHUB_USERNAME }}
3744
password: ${{ secrets.DOCKERHUB_TOKEN }}
3845

3946
- name: Push to Docker Hub
40-
if: github.ref == 'refs/heads/y-sakamoto/auto-deploy' && github.event_name == 'push'
47+
if: github.ref == 'main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true'
4148
run: |
4249
docker push opensourcecobol/opensourcecobol4j:"$version_string_prefix"-debug
4350
docker push opensourcecobol/opensourcecobol4j:"$version_string_prefix"-debug-latest
@@ -62,13 +69,13 @@ jobs:
6269
--build-arg Open_COBOL_ESQL_4J_version="$Open_COBOL_ESQL_4J_version"
6370
6471
- name: Login to Docker Hub
65-
if: github.ref == 'refs/heads/y-sakamoto/auto-deploy' && github.event_name == 'push'
72+
if: github.ref == 'main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true'
6673
uses: docker/login-action@v3
6774
with:
6875
username: ${{ secrets.DOCKERHUB_USERNAME }}
6976
password: ${{ secrets.DOCKERHUB_TOKEN }}
7077

7178
- name: Push to Docker Hub
72-
if: github.ref == 'refs/heads/y-sakamoto/auto-deploy' && github.event_name == 'push'
79+
if: github.ref == 'main' && github.event_name == 'workflow_dispatch' && inputs.push_to_dockerhub == 'true'
7380
run: |
7481
docker push opensourcecobol/opensourcecobol4j:utf8-"$version_string_prefix"-debug

0 commit comments

Comments
 (0)