diff --git a/.github/workflows/post.yml b/.github/workflows/post.yml index dd294cf0..609a02e9 100644 --- a/.github/workflows/post.yml +++ b/.github/workflows/post.yml @@ -4,14 +4,6 @@ on: types: [published] workflow_dispatch: inputs: - crate: - type: string - description: "Name of published crate" - required: false - version: - type: string - description: "Version of published crate." - required: false message: description: "Just message to post." required: false @@ -33,6 +25,9 @@ jobs: message: | 🦀 Rusty Playdate Updated! + ${{ inputs.message || (github.event_name == 'release' && 'New release published.' || '') }} + + ${{ steps.url.outputs.value }} #rust #rustdev #playdate diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f683fef..e1854570 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,9 +60,20 @@ jobs: ignore-unpublished-changes: ${{ github.head_ref == 'false' }} registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} - - name: Post - # if: fromJSON(steps.publisher.outputs.published).* && (github.event.inputs.dry-run == 'true' || (github.head_ref && 'true')) - if: fromJSON(steps.publisher.outputs.published).* + - name: Count published + id: counter + if: (github.event.inputs.dry-run == 'true' || (github.head_ref && 'true') || 'false') == 'false' + env: + CRATES: ${{ steps.publisher.outputs.published }} run: | + echo "$CRATES" + CRATES_NUM=$(echo $CRATES | jq '. | length') + echo "value=$CRATES_NUM" >> "$GITHUB_OUTPUT" LIST="${{ join(fromJSON(steps.publisher.outputs.published).*.name, ', ') }}" - echo "Published crates: $LIST" + echo "Published $CRATES_NUM crates: $LIST" + + - name: Post + if: fromJSON(steps.publisher.outputs.published).* && (github.event.inputs.dry-run == 'true' || (github.head_ref && 'true')) + uses: ./.github/workflows/post.yml + with: + message: Crate${{ steps.counter.outputs.value == 1 && '' || 's' }} ${{ join(fromJSON(steps.publisher.outputs.published).*.name, ', ') }} updated.