From b2cce5cab080780782766669ff0360b6d8c0f2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Mon, 15 Nov 2021 14:50:50 +0100 Subject: [PATCH] ci: trigger bee-js bee update (#58) --- .github/workflows/publish.yaml | 22 ++++++++++++++++------ scripts/publish-environment.sh | 6 ++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7e98344..7fa5af2 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -47,12 +47,12 @@ jobs: - name: Override inputs from `workflow_dispatch` run: | - if [[ '${{ github.event_name }}" == "workflow_dispatch"]]; then - echo "BEE_VERSION=${{ github.event.inputs.beeVersion }}" >> $GITHUB_ENV - echo "BUILD_IMAGE=${{ github.event.inputs.beeVersionAsCommitHash }}" >> $GITHUB_ENV - echo "COMMIT_VERSION_TAG=${{ github.event.inputs.commitVersionTag }}" >> $GITHUB_ENV - echo "STATE_COMMIT=${{ github.event.inputs.stateCommit }}" >> $GITHUB_ENV - fi + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "BEE_VERSION=${{ github.event.inputs.beeVersion }}" >> $GITHUB_ENV + echo "BUILD_IMAGE=${{ github.event.inputs.beeVersionAsCommitHash }}" >> $GITHUB_ENV + echo "COMMIT_VERSION_TAG=${{ github.event.inputs.commitVersionTag }}" >> $GITHUB_ENV + echo "STATE_COMMIT=${{ github.event.inputs.stateCommit }}" >> $GITHUB_ENV + fi - name: Auth to Github Package Docker Registry if: ${{ github.event_name == 'repository_dispatch' || (github.event.inputs.buildImage == 'true' && success()) }} @@ -74,6 +74,16 @@ jobs: npm run build:env -- $BUILD_PARAMS - name: Publish if required + id: publish if: ${{ github.event_name == 'repository_dispatch' || (github.event.inputs.buildImage == 'true' && success()) }} run: | npm run publish:env + + - name: Trigger Bee-js PR creation + if: ${{ github.event_name == 'repository_dispatch' }} + uses: peter-evans/repository-dispatch@v1 + with: + token: ${{ secrets.REPO_GHA_PAT }} + repository: ethersphere/bee-js + event-type: update-bee + client-payload: '{"imageVersion": "${{ steps.publish.outputs.bee-version }}"}' diff --git a/scripts/publish-environment.sh b/scripts/publish-environment.sh index be73930..7f11fe4 100755 --- a/scripts/publish-environment.sh +++ b/scripts/publish-environment.sh @@ -33,3 +33,9 @@ done echo "Push Blockchain docker image: $BLOCKCHAIN_IMAGE_NAME" docker push "$BLOCKCHAIN_IMAGE_NAME" + +# This sets output parameter in Github Actions that +# is then used to trigger Bee-js PR creation +if [ $CI == 'true' ]; then + echo "::set-output name=bee-version::$BEE_VERSION" +fi