diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index 5315833f..49ea8b91 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -61,6 +61,7 @@ jobs: # gh release create "v$VERSION" --generate-notes --target main - name: Publish NPM pre-release + id: publish_prerelease if: steps.changesets.outputs.published != 'true' continue-on-error: true env: @@ -74,24 +75,54 @@ jobs: yarn run changeset publish --no-git-tag --snapshot canary --tag canary - name: Get NPM Version - if: steps.changesets.outputs.published != 'true' + if: steps.publish_prerelease.outcome == 'success' id: get_version run: | VERSION=$(node -pe "require('./package.json').version") - echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Comment Version on Pull Request - if: steps.changesets.outputs.published != 'true' + if: steps.publish_prerelease.outcome == 'success' && steps.changesets.outputs.pullRequestNumber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Find PR associated with the current commit - PR_NUMBER=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls \ - --jq '.[0].number' 2>/dev/null || echo "") - - if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then - gh pr comment $PR_NUMBER --body "Published pre-release version: ${{ env.VERSION }}" - echo "Commented on PR #$PR_NUMBER" - else - echo "No associated PR found. This might be a direct push to main." - fi + gh pr comment ${{ steps.changesets.outputs.pullRequestNumber }} \ + --body "Published pre-release version: ${{ steps.get_version.outputs.VERSION }}" + echo "Commented on PR #${{ steps.changesets.outputs.pullRequestNumber }}" + + - name: Send Slack notification + if: steps.publish_prerelease.outcome == 'success' + continue-on-error: true + uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: incoming-webhook + payload: | + { + "text": "📦 AppKit RN Canary Published", + "blocks": [ + { + "type": "header", + "text": { "type": "plain_text", "text": "📦 AppKit RN Canary Published" } + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Version:*\n`${{ steps.get_version.outputs.VERSION }}`" }, + { "type": "mrkdwn", "text": "*Tag:*\n`canary`" }, + { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" }, + { "type": "mrkdwn", "text": "*Triggered by:*\n`${{ github.actor }}`" } + ] + }, + { + "type": "section", + "text": { "type": "mrkdwn", "text": "*NPM:* " } + }, + { + "type": "context", + "elements": [ + { "type": "mrkdwn", "text": "Install: `yarn add @reown/appkit-react-native@canary`" } + ] + } + ] + } diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 1c2c8632..e657fdd8 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -92,6 +92,50 @@ jobs: yarn run changeset:prepublish:ci yarn run changeset publish --no-git-tag --snapshot $snapshot --tag $snapshot + - name: Get NPM Version + if: steps.check-changesets.outputs.has_changesets == 'true' + id: get_version + run: | + VERSION=$(node -pe "require('./package.json').version") + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + + - name: Send Slack notification + if: steps.check-changesets.outputs.has_changesets == 'true' + continue-on-error: true + uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + webhook-type: incoming-webhook + payload: | + { + "text": "📦 AppKit RN Snapshot Published", + "blocks": [ + { + "type": "header", + "text": { "type": "plain_text", "text": "📦 AppKit RN Snapshot Published" } + }, + { + "type": "section", + "fields": [ + { "type": "mrkdwn", "text": "*Version:*\n`${{ steps.get_version.outputs.VERSION }}`" }, + { "type": "mrkdwn", "text": "*Tag:*\n`${{ steps.determine-tag.outputs.tag }}`" }, + { "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" }, + { "type": "mrkdwn", "text": "*Triggered by:*\n`${{ github.actor }}`" } + ] + }, + { + "type": "section", + "text": { "type": "mrkdwn", "text": "*NPM:* " } + }, + { + "type": "context", + "elements": [ + { "type": "mrkdwn", "text": "Install: `yarn add @reown/appkit-react-native@${{ steps.determine-tag.outputs.tag }}`" } + ] + } + ] + } + - name: Get Snapshot Tag id: get-snapshot-tag run: |