From bbd6d39b8273e66b0c55f4dc2630b686ded4c10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Tue, 28 Jun 2022 14:56:35 -0300 Subject: [PATCH] add payload forwarder --- .github/workflows/docker.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9cbabd3..4af649f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,7 +12,7 @@ on: jobs: build: runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v2 @@ -20,7 +20,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - + - name: Use default DOCKER_TAG if: startsWith(github.ref, 'refs/tags/') != true run: | @@ -28,38 +28,50 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - + - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + # This step is required to lowercase gsKit - id: string uses: ASzc/change-string-case-action@v1 with: string: ${{ github.repository }} - + - uses: docker/build-push-action@v2 with: push: true tags: ${{ steps.string.outputs.lowercase }}:${{ env.DOCKER_TAG }} build-args: | BASE_DOCKER_IMAGE=${{ github.repository_owner }}/ps2sdk:${{ env.DOCKER_TAG }} - + - name: Send Compile action run: | export DISPATCH_ACTION="$(echo run_build)" echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV + - name: "create payload with this repository payload" + if: ${{ github.event_name }} != 'repository_dispatch' + run: | + export REPO_PAYLOAD="$(echo {\"ref\": \"${{ github.ref }}\", \"parent\": \"${{ github.repository }}\", \"parent_sha\": \"${{ steps.slug.outputs.sha8 }}\"})" + echo "NEW_REPO_PAYLOAD=$REPO_PAYLOAD" >> $GITHUB_ENV + + - name: "create payload with parent repository payload" + if: ${{ github.event_name }} == 'repository_dispatch' + run: | + export REPO_PAYLOAD="$(echo {\"ref\": \"${{ github.ref }}\", \"parent:\" \"${{ github.event.client_payload.parent }}\", \"parent_sha\": \"${{ github.event.client_payload.parent_sha }}\"})" + echo "NEW_REPO_PAYLOAD=$REPO_PAYLOAD" >> $GITHUB_ENV + - name: Repository Dispatch uses: peter-evans/repository-dispatch@v1 with: repository: ${{ github.repository_owner }}/ps2sdk-ports token: ${{ secrets.DISPATCH_TOKEN }} event-type: ${{ env.NEW_DISPATCH_ACTION }} - client-payload: '{"ref": "${{ github.ref }}"}' \ No newline at end of file + client-payload: '${{ env.NEW_REPO_PAYLOAD }}'