feat: expo 50 upgrade (#127) #28
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
name: Deploy SDK | |
# Only run after a pull request has been merged. This is because | |
# bot account runs write operations on the github repo to push a tag. | |
on: | |
push: | |
branches: [beta] # all branches where deployments currently occur. Make sure this list matches list of branches in `.releaserc` file. | |
permissions: | |
contents: write # access to push the git tag | |
issues: write # Bot creates an issue if there is an issue during deployment process | |
pull-requests: write # allow bot to make comments on PRs after they get deployed | |
jobs: | |
deploy-git-tag: | |
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: | |
- uses: actions/checkout@v4 | |
- name: Deploy git tag via semantic release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic-release | |
with: | |
semantic_version: latest | |
extra_plugins: | | |
conventional-changelog-conventionalcommits | |
@semantic-release/changelog | |
@semantic-release/git | |
@semantic-release/github | |
@semantic-release/exec | |
env: | |
# Needs to push git commits to repo. Needs write access. | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Notify team of git tag being created | |
uses: slackapi/[email protected] | |
if: steps.semantic-release.outputs.new_release_published == 'true' # only run if a git tag was made. | |
with: | |
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder | |
payload: | | |
{ | |
"text": "Expo plugin git tag created", | |
"username": "Expo deployment bot", | |
"icon_url": "https://logos-download.com/wp-content/uploads/2021/01/Expo_Logo.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Expo* plugin git tag created successfully! (deployment step 1 of 2)" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Version ${{ steps.semantic-release.outputs.new_release_version }}*\n\nExpo plugin deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{steps.semantic-release.outputs.new_release_version}}|create git tag>~\n2. deploy to npm\n\n" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Send Velocity Deployment | |
uses: codeclimate/[email protected] | |
if: steps.semantic-release.outputs.new_release_published == 'true' # only run if a git tag was made. | |
with: | |
token: ${{ secrets.VELOCITY_DEPLOYMENT_TOKEN }} | |
version: ${{ steps.semantic-release.outputs.new_release_version }} | |
environment: production | |
- 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": "Expo plugin deployment failure", | |
"username": "Expo deployment bot", | |
"icon_url": "https://logos-download.com/wp-content/uploads/2021/01/Expo_Logo.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Expo* plugin deployment :warning: failure :warning:" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Expo plugin failed deployment during step *create git tag*. 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 | |
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@v4 | |
with: | |
ref: ${{ needs.deploy-git-tag.outputs.new_release_git_head }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- run: npm ci | |
- name: Deploy to npm | |
run: ./scripts/deploy-code.sh | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- 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": "Expo plugin deployed to npm", | |
"username": "Expo deployment bot", | |
"icon_url": "https://logos-download.com/wp-content/uploads/2021/01/Expo_Logo.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Expo* plugin 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\nExpo plugin 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": "Expo plugin deployment failure", | |
"username": "Expo deployment bot", | |
"icon_url": "https://logos-download.com/wp-content/uploads/2021/01/Expo_Logo.png", | |
"channel": "#mobile-deployments", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Expo* plugin deployment :warning: failure :warning:" | |
} | |
}, | |
{ | |
"type": "divider" | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Expo plugin 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 |