Skip to content

Commit

Permalink
CI: Post after publish (#203)
Browse files Browse the repository at this point in the history
* post after publish crate

* count published crates
  • Loading branch information
boozook authored Feb 10, 2024
1 parent 4fcd2e9 commit 5a9380d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 5a9380d

Please sign in to comment.