|
20 | 20 | NUM_PAST_RELEASES: 3 |
21 | 21 |
|
22 | 22 | jobs: |
| 23 | + discover: |
| 24 | + name: Discover supported releases |
| 25 | + runs-on: ubuntu-latest |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + packages: read |
| 29 | + outputs: |
| 30 | + branches: ${{ step.discover.outputs.branches }} |
| 31 | + develop-branch: ${{ step.discover.outputs.develop-branch }} |
| 32 | + steps: |
| 33 | + - name: Discover maintained releases |
| 34 | + id: discover |
| 35 | + run: | |
| 36 | + DEVELOPMENT_BRANCH=$( curl -f -sS https://api.github.com/repos/${{ github.repository }} | jq -r '.default_branch' ) |
| 37 | + echo "develop-branch=$DEVELOPMENT_BRANCH" | tee -a "${GITHUB_OUTPUT}" |
| 38 | + |
| 39 | + SUPPORTED_BRANCHES=$( curl -f -sS https://api.github.com/repos/IQSS/dataverse/releases | jq -r " .[0:${{ env.NUM_PAST_RELEASES }}] | .[].tag_name, \"${DEVELOPMENT_BRANCH}\" " | tr "\n" " " ) |
| 40 | + echo "branches=$SUPPORTED_BRANCHES" | tee -a "${GITHUB_OUTPUT}" |
| 41 | +
|
23 | 42 | base-image: |
24 | 43 | name: Base Image Matrix Build |
25 | 44 | runs-on: ubuntu-latest |
|
28 | 47 | packages: read |
29 | 48 | # Only run in upstream repo - avoid unnecessary runs in forks |
30 | 49 | if: ${{ github.repository_owner == 'IQSS' }} |
| 50 | + needs: |
| 51 | + - discover |
31 | 52 | outputs: |
32 | 53 | # This is a JSON map with keys of branch names (supported releases & develop) and values containing an array of known image tags for the branch |
33 | 54 | # Example: {"v6.6": ["latest", "6.6-noble", "6.6-noble-r1"], "v6.5": ["6.5-noble", "6.5-noble-r5"], "v6.4": ["6.4-noble", "6.4-noble-r12"], "develop": ["unstable", "6.7-noble", "6.7-noble-p6.2025.3-j17"]} |
@@ -55,20 +76,13 @@ jobs: |
55 | 76 | with: |
56 | 77 | platforms: ${{ env.PLATFORMS }} |
57 | 78 |
|
58 | | - # Discover the releases we want to maintain |
59 | | - - name: Discover maintained releases |
60 | | - id: discover |
61 | | - run: | |
62 | | - echo "FORCE_BUILD=$( [[ "${{ inputs.force_build }}" = "true" ]] && echo 1 || echo 0 )" | tee -a "$GITHUB_ENV" |
63 | | - DEVELOPMENT_BRANCH=$( curl -f -sS https://api.github.com/repos/${{ github.repository }} | jq -r '.default_branch' ) |
64 | | - echo "DEVELOPMENT_BRANCH=$DEVELOPMENT_BRANCH" | tee -a "$GITHUB_ENV" |
65 | | - echo "branches=$( curl -f -sS https://api.github.com/repos/IQSS/dataverse/releases | jq -r " .[0:${{ env.NUM_PAST_RELEASES }}] | .[].tag_name, \"${DEVELOPMENT_BRANCH}\" " | tr "\n" " " )" | tee -a "${GITHUB_OUTPUT}" |
66 | | -
|
67 | 79 | # Execute matrix build for the discovered branches |
68 | 80 | - name: Execute build matrix script |
69 | 81 | id: execute |
70 | | - run: | |
71 | | - .github/workflows/scripts/containers/maintain-base.sh ${{ steps.discover.outputs.branches }} |
| 82 | + run: > |
| 83 | + FORCE_BUILD=$( [[ "${{ inputs.force_build }}" = "true" ]] && echo 1 || echo 0 ) |
| 84 | + DEVELOPMENT_BRANCH=${{ needs.discover.outputs.develop-branch }} |
| 85 | + .github/workflows/scripts/containers/maintain-base.sh ${{ needs.discover.outputs.branches }} |
72 | 86 |
|
73 | 87 | # TODO: Use the needs.build.outputs.rebuilt_base_images with fromJSON() to create a matrix job. |
74 | 88 | # Must be a single rank matrix (vector), the branch and base image tag information ships as "branch=tag" string |
|
0 commit comments