Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add payload forwarder #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Extract DOCKER_TAG using tag name
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: |
echo "DOCKER_TAG=latest" >> $GITHUB_ENV

- 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:
Expand All @@ -44,16 +44,28 @@ jobs:
tags: ${{ github.repository }}:${{ env.DOCKER_TAG }}
build-args: |
BASE_DOCKER_IMAGE=${{ github.repository_owner }}/gskit:${{ 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 }}/ps2dev
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: ${{ env.NEW_DISPATCH_ACTION }}
client-payload: '{"ref": "${{ github.ref }}"}'
client-payload: '${{ env.NEW_REPO_PAYLOAD }}'