6.1.1 #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to npm | |
| # Deploying to npm must be done manually after the git tag is made. | |
| # This is a temporary workaround at this time until this is done: https://github.com/customerio/issues/issues/9287 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tagToDeploy: | |
| description: 'Type name of existing git tag (example: 1.0.3) to push to npm' | |
| required: true | |
| type: string | |
| env: | |
| COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
| jobs: | |
| deploy-cocoapods: | |
| name: Deploy SDK to Cocoapods | |
| runs-on: macos-12 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Checkout existing tag if manually running CI task | |
| uses: actions/checkout@v4 | |
| # If input is not given, that probably means this CI task was run automatically by a new | |
| # git tag being pushed. Skip this step and try to deploy pods for new tag. | |
| if: ${{ github.event.inputs.tagToDeploy != '' }} | |
| with: | |
| ref: ${{ github.event.inputs.tagToDeploy }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm ci | |
| - name: Deploy to npm | |
| run: ./scripts/deploy-code.sh | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| IS_PRERELEASE: false # at this time, all deployments are made to `main` production branch | |
| - name: Notify team of successful deployment | |
| uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 | |
| if: ${{ success() }} | |
| with: | |
| # Use block kit to format the Slack message: https://app.slack.com/block-kit-builder | |
| payload: | | |
| { | |
| "text": "ReactNative SDK deployed to npm", | |
| "username": "ReactNative deployment bot", | |
| "icon_url": "https://vectorified.com/images/icon-react-native-24.png", | |
| "channel": "#mobile-deployments", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*ReactNative* SDK deployed to npm! (deployment step 2 of 2)" | |
| } | |
| }, | |
| { | |
| "type": "divider" | |
| }, | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*Version ${{ needs.deploy-git-tag.outputs.new_release_version }}*\n\nReactNative SDK deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{ needs.deploy-git-tag.outputs.new_release_version }}|create git tag>~\n~2. deploy to npm~\n\n" | |
| } | |
| } | |
| ] | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
| - name: Notify team of failure | |
| uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 | |
| if: ${{ failure() }} # only run this if any previous step failed | |
| with: | |
| # Use block kit to format the Slack message: https://app.slack.com/block-kit-builder | |
| payload: | | |
| { | |
| "text": "ReactNative SDK deployment failure", | |
| "username": "ReactNative deployment bot", | |
| "icon_url": "https://vectorified.com/images/icon-react-native-24.png", | |
| "channel": "#mobile-deployments", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "*ReactNative* SDK deployment :warning: failure :warning:" | |
| } | |
| }, | |
| { | |
| "type": "divider" | |
| }, | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "ReactNative SDK failed deployment during step *deploy to npm*. View <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|CI server logs> to learn why and fix the issue. <https://github.com/customerio/mobile/blob/main/GIT-WORKFLOW.md|Learn more about the deployment process and how to fix errors>." | |
| } | |
| } | |
| ] | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |