|
8 | 8 | default: ""
|
9 | 9 |
|
10 | 10 | nt_branch:
|
11 |
| - description: "Native Template branch to use (Default: master)" |
12 |
| - default: "master" |
| 11 | + description: "Native Template branch/tag to use (Leave empty to auto-select based on Mendix version)" |
| 12 | + default: "" |
13 | 13 | required: false
|
14 | 14 | type: string
|
15 | 15 |
|
|
59 | 59 | - video-player-native
|
60 | 60 | - web-view-native
|
61 | 61 |
|
| 62 | + # Run at 0:00 UTC (2:00 AM CET time during summer, 1:00 AM during winter) |
| 63 | + schedule: |
| 64 | + - cron: '0 0 * * *' |
62 | 65 | # Trigger on PR
|
63 | 66 | # pull_request:
|
64 | 67 |
|
@@ -152,8 +155,78 @@ jobs:
|
152 | 155 | run: |
|
153 | 156 | echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
|
154 | 157 |
|
| 158 | +
|
| 159 | + determine-nt-version: |
| 160 | + needs: [mendix-version] |
| 161 | + runs-on: ubuntu-latest |
| 162 | + outputs: |
| 163 | + nt_branch: ${{ steps.determine-nt-branch.outputs.nt_branch }} |
| 164 | + steps: |
| 165 | + - name: "Check if nt_branch was specified" |
| 166 | + id: check-input |
| 167 | + run: | |
| 168 | + if [[ -n "${{ github.event.inputs.nt_branch }}" ]]; then |
| 169 | + echo "Using specified nt_branch: ${{ github.event.inputs.nt_branch }}" |
| 170 | + echo "nt_branch=${{ github.event.inputs.nt_branch }}" >> $GITHUB_OUTPUT |
| 171 | + echo "source=input" >> $GITHUB_OUTPUT |
| 172 | + else |
| 173 | + echo "No nt_branch specified, will determine from mendix_version" |
| 174 | + echo "source=auto" >> $GITHUB_OUTPUT |
| 175 | + fi |
| 176 | +
|
| 177 | + - name: "Download mendix_version.json from native-template repo" |
| 178 | + if: steps.check-input.outputs.source == 'auto' |
| 179 | + run: | |
| 180 | + curl -s -o mendix_version.json https://raw.githubusercontent.com/mendix/native-template/master/mendix_version.json |
| 181 | + cat mendix_version.json |
| 182 | +
|
| 183 | + - name: "Determine Native Template version based on Mendix version" |
| 184 | + if: steps.check-input.outputs.source == 'auto' |
| 185 | + id: determine-nt-branch |
| 186 | + run: | |
| 187 | + mendix_version="${{ needs.mendix-version.outputs.mendix_version }}" |
| 188 | + # Extract just the major.minor.patch part without any suffixes |
| 189 | + mendix_version_base=$(echo $mendix_version | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/') |
| 190 | + |
| 191 | + echo "Mendix version: $mendix_version" |
| 192 | + echo "Mendix base version: $mendix_version_base" |
| 193 | + |
| 194 | + # Use jq to find the appropriate NT version |
| 195 | + nt_version=$(jq -r --arg mv "$mendix_version_base" ' |
| 196 | + # Define version comparison function first |
| 197 | + def version_to_int(v): v | split(".") | map(tonumber) | .[0]*1000000 + .[1]*1000 + .[2]; |
| 198 | + |
| 199 | + # Convert input Mendix version to comparable format |
| 200 | + ($mv | version_to_int) as $mv_int | |
| 201 | + |
| 202 | + # Find matching range |
| 203 | + to_entries | |
| 204 | + map( |
| 205 | + select( |
| 206 | + (.value.min_mendix_version | version_to_int) <= $mv_int and |
| 207 | + (if .value.max_mendix_version then (.value.max_mendix_version | version_to_int) >= $mv_int else true end) |
| 208 | + ) |
| 209 | + ) | |
| 210 | + |
| 211 | + # Get the latest matching NT version |
| 212 | + sort_by(.key | split(".") | map(tonumber)) | |
| 213 | + last | |
| 214 | + if . then .key else "master" end |
| 215 | + ' mendix_version.json) |
| 216 | + |
| 217 | + echo "Selected Native Template version: $nt_version" |
| 218 | + echo "nt_branch=$nt_version" >> $GITHUB_OUTPUT |
| 219 | +
|
| 220 | + - name: "Set output nt_branch" |
| 221 | + id: set-output |
| 222 | + run: | |
| 223 | + if [[ "${{ steps.check-input.outputs.source }}" == "input" ]]; then |
| 224 | + echo "nt_branch=${{ steps.check-input.outputs.nt_branch }}" >> $GITHUB_OUTPUT |
| 225 | + else |
| 226 | + echo "nt_branch=${{ steps.determine-nt-branch.outputs.nt_branch }}" >> $GITHUB_OUTPUT |
| 227 | + fi |
155 | 228 | docker-images:
|
156 |
| - needs: mendix-version |
| 229 | + needs: [mendix-version] |
157 | 230 | runs-on: ubuntu-22.04
|
158 | 231 | steps:
|
159 | 232 | - name: "Login to GitHub Container Registry"
|
@@ -311,14 +384,14 @@ jobs:
|
311 | 384 | platform: ios
|
312 | 385 | mda-file: automation.mda
|
313 | 386 | android-app:
|
314 |
| - needs: [android-bundle] |
| 387 | + needs: [android-bundle, determine-nt-version] |
315 | 388 | runs-on: ubuntu-22.04
|
316 | 389 | steps:
|
317 | 390 | - name: "Check out Native Template for Native Components Test Project"
|
318 | 391 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
319 | 392 | with:
|
320 | 393 | repository: mendix/native-template
|
321 |
| - ref: ${{ github.event.inputs.nt_branch || 'master' }} |
| 394 | + ref: ${{ needs.determine-nt-version.outputs.nt_branch }} |
322 | 395 | path: native-template
|
323 | 396 | - name: "Check out code"
|
324 | 397 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
@@ -377,14 +450,14 @@ jobs:
|
377 | 450 | name: android-app
|
378 | 451 | path: native-template/android/app/build/outputs/apk/**/*.apk
|
379 | 452 | ios-app:
|
380 |
| - needs: [ios-bundle] |
| 453 | + needs: [ios-bundle, determine-nt-version] |
381 | 454 | runs-on: macos-13
|
382 | 455 | steps:
|
383 | 456 | - name: "Check out Native Template for Native Components Test Project"
|
384 | 457 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
385 | 458 | with:
|
386 | 459 | repository: mendix/native-template
|
387 |
| - ref: ${{ github.event.inputs.nt_branch || 'master' }} |
| 460 | + ref: ${{ needs.determine-nt-version.outputs.nt_branch }} |
388 | 461 | path: native-template
|
389 | 462 | - name: "Check out code"
|
390 | 463 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
0 commit comments