-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
name: Deploy git tag | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_release_git_head: ${{ steps.semantic-release.outputs.new_release_git_head }} | ||
new_release_published: ${{ steps.semantic-release.outputs.new_release_published }} | ||
new_release_version: ${{ steps.semantic-release.outputs.new_release_version }} | ||
steps: | ||
|
@@ -106,4 +107,96 @@ jobs: | |
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
|
||
|
||
deploy-npm: | ||
name: Deploy to npm | ||
needs: [deploy-git-tag] | ||
if: needs.deploy-git-tag.outputs.new_release_published == 'true' # only run if a git tag was made. | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.deploy-git-tag.outputs.new_release_git_head }} | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
cache: 'yarn' | ||
|
||
- run: yarn install --frozen-lockfile | ||
|
||
- 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/[email protected] | ||
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/[email protected] | ||
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 |