Skip to content

Commit

Permalink
improve post publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
boozook authored and github-actions[bot] committed Apr 3, 2024
1 parent 77cb234 commit d83e24f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Publish
on:
# pull_request_target:
pull_request_target:
types: ready_for_review
branches: [main, master]
workflow_dispatch:
inputs:
sdk:
Expand Down Expand Up @@ -75,14 +77,25 @@ jobs:
LIST="${{ join(fromJSON(steps.publisher.outputs.published).*.name, ', ') }}"
echo "Published $CRATES_NUM crates: $LIST"
- name: Message
id: message
env:
CRATES: ${{ steps.publisher.outputs.published }}
run: |
MESSAGE_LIST=$(echo $CRATES | jq -r 'to_entries[] | "Crates updated:\n\(.key+1). \(.value.name): v\(.value.version)"')
MESSAGE_LINE=$(echo $CRATES | jq -r 'to_entries[] | "Crate updated: \(.value.name) v\(.value.version)"')
MESSAGE="${{ steps.counter.outputs.value > 1 && '${MESSAGE_LIST}' || ' ${MESSAGE_LINE}' }}"
echo 'value="${MESSAGE?}"' >> "$GITHUB_OUTPUT"
outputs:
published: ${{ steps.publisher.outputs.published }}
counter: ${{ steps.counter.outputs.value }}
message: ${{ steps.message.outputs.value }}

post:
needs: crates-io
if: join(fromJSON(needs.crates-io.outputs.published).*.name, '-') && (github.event.inputs.dry-run == 'true' || (github.head_ref && 'true') || 'false') == 'false'
uses: ./.github/workflows/post.yml
secrets: inherit
with:
message: "Crate${{ needs.crates-io.outputs.counter > 1 && 's' || '' }} updated: ${{ join(fromJSON(needs.crates-io.outputs.published).*.name, ', ') }}."
message: "${{ needs.crates-io.outputs.message }}"

0 comments on commit d83e24f

Please sign in to comment.