-
Notifications
You must be signed in to change notification settings - Fork 9
103 lines (98 loc) · 4.18 KB
/
manual-deployment.yml
File metadata and controls
103 lines (98 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Manual Deploy to Maven Central
# Trigger this manual deployment in scenarios where:
# A git tag exists, but the initial deployment failed and fix has been pushed to main.
# This avoids the need to recreate the tag for redeployment.
on:
workflow_dispatch: # allows for manual triggering
jobs:
deploy-sonatype:
name: Deploy SDK to Maven Central
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0 # fetches all history for all tags and branches
- name: Get latest tag
id: get-latest-tag
run: |
echo '::group::Get latest tag'
TAG=$(git describe --tags --abbrev=0)
echo "TAG=$TAG" >> $GITHUB_ENV
echo '::endgroup::'
- uses: ./.github/actions/setup-android
- name: Push to Sonatype servers
run: MODULE_VERSION=${{ env.TAG }} ./scripts/deploy-code.sh
env:
OSSRH_USERNAME: ${{ secrets.GRADLE_PUBLISH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.GRADLE_PUBLISH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.GRADLE_SIGNING_KEYID }}
SIGNING_PASSWORD: ${{ secrets.GRADLE_SIGNING_PASSPHRASE }}
SIGNING_KEY: ${{ secrets.GRADLE_SIGNING_PRIVATE_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
- name: Notify team of successful deployment
uses: slackapi/slack-github-action@71c4f79cb8ada5ed920ec668b73f8530444a133b # v2.0.0-rc.3
if: ${{ success() }}
with:
payload: |
{
"text": "Android SDK deployed to Maven Central",
"username": "Android deployment bot",
"icon_url": "https://media.pocketgamer.com/artwork/na-qulrguj/android.jpg",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Android* SDK deployed to Maven Central! (manual deployment)"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Version:* ${{ env.TAG }}\n\nAndroid SDK deployment progress:\n~1. Git tag already created~\n~2. Manual deploy to maven central~\n\n"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFY_RELEASES_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Notify team of failure
uses: slackapi/slack-github-action@71c4f79cb8ada5ed920ec668b73f8530444a133b # v2.0.0-rc.3
if: ${{ failure() }}
with:
payload: |
{
"text": "Android SDK deployment failure",
"username": "Android deployment bot",
"icon_url": "https://media.pocketgamer.com/artwork/na-qulrguj/android.jpg",
"channel": "#mobile-deployments",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Android* SDK deployment :warning: failure :warning:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Android SDK failed deployment during step *deploy to maven central*. 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_NOTIFY_RELEASES_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK