11name : openstudio-docker
22
3- on : [push, pull_request]
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - develop
8+ pull_request :
9+ workflow_dispatch :
10+ inputs :
11+ openstudio_version :
12+ description : ' OpenStudio version (e.g. 3.10.0)'
13+ required : true
14+ default : ' 3.11.0'
15+ openstudio_sha :
16+ description : ' OpenStudio git SHA'
17+ required : true
18+ default : ' dee62bf9dd'
19+ openstudio_version_ext :
20+ description : ' Version extension (e.g. -rc1). Leave blank for a final release. Default: -rc1'
21+ required : false
22+ default : ' '
23+ apptainer_only :
24+ description : ' Skip docker build/test and only build the .sif from an existing Docker Hub image'
25+ required : false
26+ default : ' false'
27+ type : boolean
428
529# example of how to restrict to one branch and push event
630# on:
1741 OPENSTUDIO_VERSION : 3.11.0
1842 OPENSTUDIO_SHA : dee62bf9dd
1943 OPENSTUDIO_VERSION_EXT : " -rc1"
20- OPENSTUDIO_DOWNLOAD_URL : " https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-22 .04-x86_64.deb"
44+ OPENSTUDIO_DOWNLOAD_URL : " https://openstudio-ci-builds.s3-us-west-2.amazonaws.com/develop/OpenStudio-3.11.0-rc1%2Bdee62bf9dd-Ubuntu-24 .04-x86_64.deb"
2145
2246permissions :
2347 contents : read
2448
2549jobs :
50+ setup :
51+ runs-on : ubuntu-24.04
52+ outputs :
53+ openstudio_version : ${{ steps.resolve.outputs.openstudio_version }}
54+ openstudio_sha : ${{ steps.resolve.outputs.openstudio_sha }}
55+ openstudio_version_ext : ${{ steps.resolve.outputs.openstudio_version_ext }}
56+ steps :
57+ - name : Resolve version
58+ id : resolve
59+ shell : bash
60+ run : |
61+ # Start from workflow-level defaults
62+ VERSION="${OPENSTUDIO_VERSION}"
63+ SHA="${OPENSTUDIO_SHA}"
64+ EXT="${OPENSTUDIO_VERSION_EXT}"
65+
66+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
67+ # Override version/sha if provided (they are required inputs so always non-empty)
68+ VERSION="${{ inputs.openstudio_version }}"
69+ SHA="${{ inputs.openstudio_sha }}"
70+ # Unconditionally assign ext — empty string IS a valid value (final release)
71+ # Do NOT use || here: "" || "-rc1" evaluates to "-rc1" in GHA expressions
72+ EXT="${{ inputs.openstudio_version_ext }}"
73+ fi
74+
75+ echo "openstudio_version=${VERSION}" >> "$GITHUB_OUTPUT"
76+ echo "openstudio_sha=${SHA}" >> "$GITHUB_OUTPUT"
77+ echo "openstudio_version_ext=${EXT}" >> "$GITHUB_OUTPUT"
78+ echo "Resolved: OpenStudio ${VERSION}${EXT} (${SHA})"
79+
2680 docker :
81+ needs : setup
2782 runs-on : ubuntu-24.04
83+ env :
84+ OPENSTUDIO_VERSION : ${{ needs.setup.outputs.openstudio_version }}
85+ OPENSTUDIO_SHA : ${{ needs.setup.outputs.openstudio_sha }}
86+ OPENSTUDIO_VERSION_EXT : ${{ needs.setup.outputs.openstudio_version_ext }}
2887 steps :
2988 - uses : actions/checkout@v4
3089 - uses : actions/setup-python@v5
3190 with :
3291 python-version : ' 3.12.x'
3392
3493 - name : test and build
94+ if : ${{ github.event.inputs.apptainer_only != 'true' }}
3595 shell : bash
3696 run : |
3797 set -euo pipefail
@@ -56,8 +116,12 @@ jobs:
56116
57117 apptainer :
58118 runs-on : ubuntu-24.04
59- needs : docker
60- if : ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }}
119+ needs : [setup, docker]
120+ if : ${{ github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/custom_branch_name' }}
121+ env :
122+ OPENSTUDIO_VERSION : ${{ needs.setup.outputs.openstudio_version }}
123+ OPENSTUDIO_SHA : ${{ needs.setup.outputs.openstudio_sha }}
124+ OPENSTUDIO_VERSION_EXT : ${{ needs.setup.outputs.openstudio_version_ext }}
61125 permissions :
62126 contents : read
63127 id-token : write
0 commit comments