Skip to content

Commit c2738d1

Browse files
committed
Added INSTALL_LATEST for manual trigger so it's somewhat testable.
1 parent 7191c49 commit c2738d1

File tree

3 files changed

+37
-12
lines changed

3 files changed

+37
-12
lines changed

.github/workflows/db-update-dev.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
workflow_dispatch:
1313
inputs:
1414
DRY_RUN:
15-
description: Skip applying schema and content updates
15+
description: Dry run. Skip applying schema and content updates
1616
required: false
1717
default: false
1818
type: boolean
@@ -28,9 +28,14 @@ jobs:
2828
API_BASE_URL: api-dev.mobilitydatabase.org
2929
# DRY_RUN is only if requested by the user in a workflow_dispatch
3030
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.DRY_RUN }}
31-
# We always want to install the latest except if we received a dispatch from mobility_database_catalog.
32-
# In that case we want to keep the currently installed version.
33-
INSTALL_LATEST: ${{ github.event_name != 'repository_dispatch' }}
31+
# We want to use the currently installed version (not the latest) if we received a dispatch from
32+
# mobility_database_catalog.
33+
# For a workflow_dispatch (manual trigger), we use the value set by the user.
34+
INSTALL_LATEST: ${{
35+
(github.event_name == 'repository_dispatch' && false) ||
36+
(github.event_name == 'workflow_dispatch' && inputs.INSTALL_LATEST)
37+
} }
38+
3439
secrets:
3540
DB_USER_PASSWORD: ${{ secrets.DEV_POSTGRE_USER_PASSWORD }}
3641
DB_USER_NAME: ${{ secrets.DEV_POSTGRE_USER_NAME }}

.github/workflows/db-update-prod.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ on:
44
workflow_dispatch: # Manual trigger
55
inputs:
66
DRY_RUN:
7-
description: Skip applying schema and content updates
7+
description: Dry run. Skip applying schema and content updates
88
required: false
99
default: false
1010
type: boolean
11+
INSTALL_LATEST:
12+
description: Install the latest (main) API version when true; when false install the currently deployed version.
13+
required: false
14+
default: true
15+
type: boolean
1116
workflow_call: []
1217
repository_dispatch: # Update on mobility-database-catalog repo dispatch
1318
types: [ catalog-sources-updated, gbfs-systems-updated ]
@@ -23,9 +28,16 @@ jobs:
2328
API_BASE_URL: api.mobilitydatabase.org
2429
# DRY_RUN is only if requested by the user in a workflow_dispatch
2530
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.DRY_RUN }}
26-
# We always want to install the latest except if we received a dispatch from mobility_database_catalog.
27-
# In that case we want to keep the currently installed version.
28-
INSTALL_LATEST: ${{ github.event_name != 'repository_dispatch' }}
31+
# We want to use the currently installed version (not the latest) if we received a dispatch from
32+
# mobility_database_catalog.
33+
# We want to use the latest version if the trigger was workflow_call, because currently it's used for
34+
# upgrading (e.g. release.yml)
35+
# For a workflow_dispatch (manual trigger), we use the value set by the user.
36+
INSTALL_LATEST: ${{
37+
(github.event_name == 'repository_dispatch' && false) ||
38+
(github.event_name == 'workflow_call' && true) ||
39+
(github.event_name == 'workflow_dispatch' && inputs.INSTALL_LATEST)
40+
}}
2941
secrets:
3042
DB_USER_PASSWORD: ${{ secrets.PROD_POSTGRE_USER_PASSWORD }}
3143
DB_USER_NAME: ${{ secrets.PROD_POSTGRE_USER_NAME }}

.github/workflows/db-update-qa.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
DRY_RUN:
7-
description: Skip applying schema and content updates
7+
description: Dry run. Skip applying schema and content updates
88
required: false
99
default: false
1010
type: boolean
@@ -25,9 +25,17 @@ jobs:
2525
API_BASE_URL: api-qa.mobilitydatabase.org
2626
# DRY_RUN is only if requested by the user in a workflow_dispatch
2727
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.DRY_RUN }}
28-
# We always want to install the latest except if we received a dispatch from mobility_database_catalog.
29-
# In that case we want to keep the currently installed version.
30-
INSTALL_LATEST: ${{ github.event_name != 'repository_dispatch' }}
28+
# We want to use the currently installed version (not the latest) if we received a dispatch from
29+
# mobility_database_catalog.
30+
# We want to use the latest version if the trigger was workflow_call, because currently it's used for
31+
# upgrading (e.g. release.yml)
32+
# For a workflow_dispatch (manual trigger), we use the value set by the user.
33+
INSTALL_LATEST: ${{
34+
(github.event_name == 'repository_dispatch' && false) ||
35+
(github.event_name == 'workflow_call' && true) ||
36+
(github.event_name == 'workflow_dispatch' && inputs.INSTALL_LATEST)
37+
}}
38+
3139
secrets:
3240
DB_USER_PASSWORD: ${{ secrets.QA_POSTGRE_USER_PASSWORD }}
3341
DB_USER_NAME: ${{ secrets.QA_POSTGRE_USER_NAME }}

0 commit comments

Comments
 (0)