Skip to content

Commit f230daf

Browse files
committed
Merge branch 'develop' into alpha
2 parents 11ee65e + 211a327 commit f230daf

3 files changed

Lines changed: 183 additions & 39 deletions

File tree

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Deploy git tag
2+
3+
# Only run after a pull request has been merged. This is because
4+
# bot account runs write operations on the github repo to push a tag.
5+
on:
6+
push:
7+
branches: [main, beta, alpha]
8+
9+
jobs:
10+
deploy-tag:
11+
name: Deploy git tag
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: semantic-release setup
15+
uses: levibostian/action-semantic-release-justwork@v1
16+
17+
- name: Deploy git tag via semantic release
18+
uses: cycjimmy/semantic-release-action@v3
19+
id: semantic-release
20+
with:
21+
# version numbers below can be in many forms: M, M.m, M.m.p
22+
semantic_version: 19
23+
extra_plugins: |
24+
conventional-changelog-conventionalcommits@4
25+
@semantic-release/changelog@6
26+
@semantic-release/npm@9
27+
@semantic-release/git@10
28+
@semantic-release/github@8
29+
env:
30+
# Needs to push git commits to repo. Needs write access.
31+
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }}
32+
33+
- name: Prepare to sync branches
34+
run: |
35+
git config --global user.email "21171259+ami-ci@users.noreply.github.com"
36+
git config --global user.name "Ami CI"
37+
- name: Copy commits into develop after main deployment
38+
uses: levibostian/action-sync-branches@v1
39+
with:
40+
behind: develop
41+
ahead: main
42+
githubToken: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }}
43+
44+
- name: Notify team of git tag being created
45+
uses: slackapi/slack-github-action@v1.18.0
46+
if: steps.semantic-release.outputs.new_release_published == 'true'
47+
with:
48+
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder
49+
payload: |
50+
{
51+
"text": "ReactNative SDK git tag created",
52+
"blocks": [
53+
{
54+
"type": "section",
55+
"text": {
56+
"type": "mrkdwn",
57+
"text": "*ReactNative* SDK git tag created successfully! (deployment step 1 of 2)"
58+
}
59+
},
60+
{
61+
"type": "divider"
62+
},
63+
{
64+
"type": "section",
65+
"text": {
66+
"type": "mrkdwn",
67+
"text": "*Version ${{ steps.semantic-release.outputs.new_release_version }}*\n\nReactNative SDK 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"
68+
}
69+
}
70+
]
71+
}
72+
env:
73+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
74+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
75+
76+
- name: Notify team of failure
77+
uses: slackapi/slack-github-action@v1.18.0
78+
if: ${{ failure() }} # only run this if any previous step failed
79+
with:
80+
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder
81+
payload: |
82+
{
83+
"text": "ReactNative SDK deployment failure",
84+
"blocks": [
85+
{
86+
"type": "section",
87+
"text": {
88+
"type": "mrkdwn",
89+
"text": "*ReactNative* SDK deployment :warning: failure :warning:"
90+
}
91+
},
92+
{
93+
"type": "divider"
94+
},
95+
{
96+
"type": "section",
97+
"text": {
98+
"type": "mrkdwn",
99+
"text": "ReactNative SDK 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."
100+
}
101+
}
102+
]
103+
}
104+
env:
105+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
106+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

.github/workflows/deploy_npm.yml

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
name: Deployment
1+
name: Deploy SDK npm
2+
3+
# If deployment tries to push to npm and then push git tags
4+
# when git tag deployment fails, you cannot push to npm again
5+
# as it doesn't allow overwriting previously deployed artifacts. Deploy
6+
# tag first, then deploy to npm on successful tag deployment.
27
on:
3-
push:
4-
branches: [main, beta, alpha]
8+
release:
9+
types: [published]
510

611
jobs:
712
deploy:
@@ -17,42 +22,73 @@ jobs:
1722

1823
- name: Compile
1924
run: yarn typescript
20-
21-
- name: Deploy via semantic release
22-
uses: cycjimmy/semantic-release-action@v3
23-
id: semantic-release
24-
with:
25-
# version numbers below can be in many forms: M, M.m, M.m.p
26-
semantic_version: 19
27-
extra_plugins: |
28-
conventional-changelog-conventionalcommits@4
29-
@semantic-release/changelog@6
30-
@semantic-release/npm@9
31-
@semantic-release/git@10
32-
@semantic-release/github@8
33-
env:
34-
# Needs to push git commits to repo. Needs write access.
35-
GITHUB_TOKEN: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }}
36-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3725

38-
- name: Prepare to sync branches
39-
run: |
40-
git config --global user.email "21171259+ami-ci@users.noreply.github.com"
41-
git config --global user.name "Ami CI"
42-
- name: Copy commits into develop after main deployment
43-
uses: levibostian/action-sync-branches@v1
26+
- name: Deploy to npm
27+
uses: JS-DevTools/npm-publish@v1
4428
with:
45-
behind: develop
46-
ahead: main
47-
githubToken: ${{ secrets.WRITE_ACCESS_BOT_TOKEN }}
48-
49-
- name: Notify team of git tag being created
50-
uses: openhousepvt/slack@v1.3.2
51-
if: steps.semantic-release.outputs.new_release_published == 'true'
29+
token: ${{ secrets.NPM_TOKEN }}
30+
31+
- name: Notify team of successful deployment
32+
uses: slackapi/slack-github-action@v1.18.0
33+
if: ${{ success() }}
34+
with:
35+
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder
36+
payload: |
37+
{
38+
"text": "ReactNative SDK deployed to npm",
39+
"blocks": [
40+
{
41+
"type": "section",
42+
"text": {
43+
"type": "mrkdwn",
44+
"text": "*ReactNative* SDK deployed to npm! (deployment step 2 of 2)"
45+
}
46+
},
47+
{
48+
"type": "divider"
49+
},
50+
{
51+
"type": "section",
52+
"text": {
53+
"type": "mrkdwn",
54+
"text": "*Version ${{ github.event.release.tag_name }}*\n\nReactNative SDK deployment progress:\n ~1. <https://github.com/${{github.repository}}/releases/tag/${{ github.event.release.tag_name }}|create git tag>~\n~2. deploy to npm~\n\n"
55+
}
56+
}
57+
]
58+
}
59+
env:
60+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
61+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
62+
63+
- name: Notify team of failure
64+
uses: slackapi/slack-github-action@v1.18.0
65+
if: ${{ failure() }} # only run this if any previous step failed
5266
with:
53-
status: 'success' # in progress status because need to now deploy SDK to maven central for full deployment
54-
version: ${{ steps.semantic-release.outputs.new_release_version }}
55-
platform: 'ReactNative SDK - deployed'
56-
channel: '#squad-mobile'
67+
# Use block kit to format the Slack message: https://app.slack.com/block-kit-builder
68+
payload: |
69+
{
70+
"text": "ReactNative SDK deployment failure",
71+
"blocks": [
72+
{
73+
"type": "section",
74+
"text": {
75+
"type": "mrkdwn",
76+
"text": "*ReactNative* SDK deployment :warning: failure :warning:"
77+
}
78+
},
79+
{
80+
"type": "divider"
81+
},
82+
{
83+
"type": "section",
84+
"text": {
85+
"type": "mrkdwn",
86+
"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."
87+
}
88+
}
89+
]
90+
}
5791
env:
58-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
92+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
93+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
94+

.releaserc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
["@semantic-release/changelog", {
1616
"changelogFile": "CHANGELOG.md"
1717
}],
18-
"@semantic-release/npm",
18+
["@semantic-release/npm", {
19+
"npmPublish": false
20+
}],
1921
"@semantic-release/git",
2022
"@semantic-release/github"
2123
]

0 commit comments

Comments
 (0)