6565 compiler_toolchain : ${{ steps.set_compiler.outputs.compiler_toolchain }}
6666 compiler_version : ${{ steps.set_compiler.outputs.compiler_version }}
6767 version : ${{ steps.set_version.outputs.version }}
68+ models : ${{ steps.set_models.outputs.models }}
6869 steps :
6970 - name : Set branch
7071 id : set_branch
@@ -126,6 +127,23 @@ jobs:
126127 exit 1
127128 fi
128129 echo "version=$ver" >> $GITHUB_OUTPUT
130+ - name : Set models
131+ id : set_models
132+ run : |
133+ # if models were selected explicitly via workflow_dispatch, use them
134+ if [[ ("${{ github.event_name }}" == "workflow_dispatch") && (-n "${{ inputs.models }}") ]]; then
135+ models="${{ inputs.models }}"
136+ echo "using model selection $models from workflow_dispatch"
137+ elif [[ ("${{ github.event_name }}" == "push") && ("${{ github.ref_name }}" != "master") ]]; then
138+ # if release was triggered by pushing a release branch, use default models
139+ models="gwf,gwt,gwe,prt"
140+ echo "using default model selection: $models"
141+ else
142+ # otherwise exit with an error
143+ echo "error: model selection could not be determined"
144+ exit 1
145+ fi
146+ echo "models=$models" >> $GITHUB_OUTPUT
129147 make_dist :
130148 name : Make distribution
131149 uses : MODFLOW-USGS/modflow6/.github/workflows/release.yml@develop
@@ -137,11 +155,15 @@ jobs:
137155 compiler_toolchain : ${{ needs.set_options.outputs.compiler_toolchain }}
138156 compiler_version : ${{ needs.set_options.outputs.compiler_version }}
139157 branch : ${{ needs.set_options.outputs.branch }}
140- developmode : ${{ inputs.developmode }}
158+ # If the workflow is manually triggered, the maintainer must manually set developmode to false, otherwise the default is true.
159+ # If triggered by pushing a release branch, the release is developmode if the branch name contains "rc", otherwise releasemode.
160+ developmode : ${{ (github.event_name == 'workflow_dispatch' && inputs.developmode == 'true') || (github.event_name != 'workflow_dispatch' && contains(github.ref_name, 'rc')) }}
141161 full : true
142- run_tests : ${{ inputs.run_tests }}
162+ # If the workflow is manually triggered, the maintainer must manually set run_tests to false, otherwise the default is true.
163+ # If triggered by pushing a release branch, tests are enabled.
164+ run_tests : ${{ (github.event_name == 'workflow_dispatch' && inputs.run_tests == 'true') || github.event_name != 'workflow_dispatch' }}
143165 version : ${{ needs.set_options.outputs.version }}
144- models : ${{ inputs .models }}
166+ models : ${{ needs.set_options.outputs .models }}
145167 pr :
146168 name : Draft release PR
147169 if : ${{ github.ref_name != 'master' && ((github.event_name == 'workflow_dispatch' && inputs.approve == 'true') || (github.event_name != 'workflow_dispatch' && !contains(github.ref_name, 'rc'))) }}
0 commit comments