6161 # gh release create "v$VERSION" --generate-notes --target main
6262
6363 - name : Publish NPM pre-release
64+ id : publish_prerelease
6465 if : steps.changesets.outputs.published != 'true'
6566 continue-on-error : true
6667 env :
@@ -74,24 +75,54 @@ jobs:
7475 yarn run changeset publish --no-git-tag --snapshot canary --tag canary
7576
7677 - name : Get NPM Version
77- if : steps.changesets.outputs.published != 'true '
78+ if : steps.publish_prerelease.outcome == 'success '
7879 id : get_version
7980 run : |
8081 VERSION=$(node -pe "require('./package.json').version")
81- echo "VERSION=$VERSION" >> $GITHUB_ENV
82+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
8283
8384 - name : Comment Version on Pull Request
84- if : steps.changesets.outputs.published != 'true'
85+ if : steps.publish_prerelease.outcome == 'success' && steps.changesets.outputs.pullRequestNumber
8586 env :
8687 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8788 run : |
88- # Find PR associated with the current commit
89- PR_NUMBER=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls \
90- --jq '.[0].number' 2>/dev/null || echo "")
91-
92- if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
93- gh pr comment $PR_NUMBER --body "Published pre-release version: ${{ env.VERSION }}"
94- echo "Commented on PR #$PR_NUMBER"
95- else
96- echo "No associated PR found. This might be a direct push to main."
97- fi
89+ gh pr comment ${{ steps.changesets.outputs.pullRequestNumber }} \
90+ --body "Published pre-release version: ${{ steps.get_version.outputs.VERSION }}"
91+ echo "Commented on PR #${{ steps.changesets.outputs.pullRequestNumber }}"
92+
93+ - name : Send Slack notification
94+ if : steps.publish_prerelease.outcome == 'success'
95+ continue-on-error : true
96+ uses : slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a
97+ with :
98+ webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
99+ webhook-type : incoming-webhook
100+ payload : |
101+ {
102+ "text": "📦 AppKit RN Canary Published",
103+ "blocks": [
104+ {
105+ "type": "header",
106+ "text": { "type": "plain_text", "text": "📦 AppKit RN Canary Published" }
107+ },
108+ {
109+ "type": "section",
110+ "fields": [
111+ { "type": "mrkdwn", "text": "*Version:*\n`${{ steps.get_version.outputs.VERSION }}`" },
112+ { "type": "mrkdwn", "text": "*Tag:*\n`canary`" },
113+ { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" },
114+ { "type": "mrkdwn", "text": "*Triggered by:*\n`${{ github.actor }}`" }
115+ ]
116+ },
117+ {
118+ "type": "section",
119+ "text": { "type": "mrkdwn", "text": "*NPM:* <https://www.npmjs.com/package/@reown/appkit-react-native/v/${{ steps.get_version.outputs.VERSION }}|@reown/appkit-react-native>" }
120+ },
121+ {
122+ "type": "context",
123+ "elements": [
124+ { "type": "mrkdwn", "text": "Install: `yarn add @reown/appkit-react-native@canary`" }
125+ ]
126+ }
127+ ]
128+ }
0 commit comments