1212 - ' **.rst'
1313 workflow_dispatch : {}
1414 repository_dispatch :
15- types : [run_build]
15+ types :
16+ - run_build
1617
1718jobs :
1819 build :
1920 env :
2021 DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
2122 DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
22- BASE_DOCKER_IMAGE_NAME : ${{ (github.event.repository.name == 'ps2sdk' && 'ps2toolchain') || (github.event.repository.name == 'ps2sdk-ports' && 'ps2sdk') || (github.event.repository.name == 'ps2-packer' && 'ps2sdk') || (github.event.repository.name == 'ps2dev' && 'ps2sdk-ports') || 'none' }}
23+ outputs :
24+ dest-repo : ${{ steps.dest-repo.outputs.DEST_REPO }}
2325 strategy :
2426 matrix :
25- runs-on : [ubuntu-latest, ubuntu-24.04-arm]
27+ runs-on :
28+ - ubuntu-latest
29+ - ubuntu-24.04-arm
2630 runs-on : ${{ matrix.runs-on }}
2731 timeout-minutes : 180
2832
3842 - name : Use default DOCKER_TAG
3943 if : startsWith(github.ref, 'refs/tags/') != true
4044 run : |
41- echo " DOCKER_TAG=latest" >> $GITHUB_ENV
45+ printf ' DOCKER_TAG=%s\n' " latest" >> $GITHUB_ENV
4246
4347 - name : Login to DockerHub
4448 uses : docker/login-action@v3
@@ -64,23 +68,27 @@ jobs:
6468 run : |
6569 printf 'DOCKER_TAG_LIST=%s\n' "ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
6670
71+ - name : Prepare additional environment variables from repo
72+ run : if test -f ./config/ci-docker-env.ini; then cat ./config/ci-docker-env.ini | sed -e 's/$REPOSITORY_OWNER/'"${{ github.repository_owner }}"'/g;s/$DOCKER_TAG/'"${{ env.DOCKER_TAG }}"'/g' >> $GITHUB_ENV; fi
73+
6774 - name : Build and Push to container registry
6875 uses : docker/build-push-action@v5
6976 with :
7077 push : true
7178 tags : ${{ env.DOCKER_TAG_LIST }}
7279 build-args : |
73- BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ env.BASE_DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }}
74- BASE_DOCKER_DVP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-dvp:${{ env.DOCKER_TAG }}
75- BASE_DOCKER_IOP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-iop:${{ env.DOCKER_TAG }}
76- BASE_DOCKER_EE_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-ee:${{ env.DOCKER_TAG }}
80+ BASE_DOCKER_IMAGE
81+ BASE_DOCKER_DVP_IMAGE
82+ BASE_DOCKER_IOP_IMAGE
83+ BASE_DOCKER_EE_IMAGE
7784
7885 - name : Gather information for repository dispatch
7986 id : dest-repo
8087 run : if test -f ./config/repository-dispatch.ini; then cat ./config/repository-dispatch.ini >> $GITHUB_OUTPUT; fi
8188
8289 perform-repository-dispatch :
83- needs : [build]
90+ needs :
91+ - build
8492 runs-on : ubuntu-latest
8593 container :
8694 image : ubuntu:20.04
9098 DISPATCH_TOKEN : ${{ secrets.DISPATCH_TOKEN }}
9199 strategy :
92100 matrix :
93- dest-repo : ${{ fromJson(needs.build.outputs.DEST_REPO ) }}
101+ dest-repo : ${{ fromJson(needs.build.outputs.dest-repo ) }}
94102
95103 steps :
104+ - name : Gather environment variables (normal)
105+ if : github.event_name != 'repository_dispatch'
106+ run : |
107+ printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.repository }}" >> $GITHUB_ENV
108+ printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.sha }}" >> $GITHUB_ENV
109+
110+ - name : Gather environment variables (dispatch)
111+ if : github.event_name == 'repository_dispatch'
112+ run : |
113+ printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.event.client_payload.parent_name }}" >> $GITHUB_ENV
114+ printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.event.client_payload.parent_sha }}" >> $GITHUB_ENV
115+
96116 - name : Send Compile action
97117 run : |
98118 export DISPATCH_ACTION="$(printf 'run_build\n')"
@@ -105,7 +125,7 @@ jobs:
105125 repository : ${{ github.repository_owner }}/${{ matrix.dest-repo }}
106126 token : ${{ secrets.DISPATCH_TOKEN }}
107127 event-type : ${{ env.NEW_DISPATCH_ACTION }}
108- client-payload : ' {"ref": "${{ github.ref }}"}'
128+ client-payload : ' {"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}" }'
109129
110130 - name : Repository Dispatch to specific ${{ matrix.dest-repo }}
111131 uses : peter-evans/repository-dispatch@v3
@@ -114,4 +134,4 @@ jobs:
114134 repository : ${{ matrix.dest-repo }}
115135 token : ${{ secrets.DISPATCH_TOKEN }}
116136 event-type : ${{ env.NEW_DISPATCH_ACTION }}
117- client-payload : ' {"ref": "${{ github.ref }}"}'
137+ client-payload : ' {"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}" }'
0 commit comments