-
-
Notifications
You must be signed in to change notification settings - Fork 101
151 lines (139 loc) · 4.56 KB
/
deploy-firebase-beta.yml
File metadata and controls
151 lines (139 loc) · 4.56 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Deploy to Firebase Beta
on:
workflow_dispatch:
inputs:
branch:
description: "Branch name to build and deploy from"
required: true
type: string
default: master
group:
description: "Tester group to deploy to"
required: true
type: choice
options:
- Greenstand
- dev
- debug
default: Greenstand
release_notes:
description: "Release Notes"
required: true
type: string
jobs:
bump-version:
name: Bump version code
runs-on: ubuntu-latest
outputs:
version_code: ${{ steps.bump.outputs.version_code }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
token: ${{ secrets.ADMIN_PAT }}
- name: Bump version code
id: bump
uses: ./.github/workflows/actions/bump-version
with:
branch: ${{ inputs.branch }}
build:
name: Build beta APK
needs: bump-version
uses: ./.github/workflows/build.yml
with:
build_variant: beta
source_ref: ${{ inputs.branch }}
upload_artifact: true
secrets: inherit
deploy:
name: Deploy to Firebase
runs-on: ubuntu-latest
needs: [bump-version, build]
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Download APK artifact
uses: actions/download-artifact@v4
with:
name: app-beta
- name: Resolve APK path
id: resolve-apk
shell: bash
run: |
APK_FILE=$(find . -maxdepth 3 -type f -name "*.apk" | head -n 1)
if [ -z "$APK_FILE" ]; then
echo "No APK found after artifact download."
find . -maxdepth 4 -type f
exit 1
fi
echo "apk_file=$APK_FILE" >> "$GITHUB_OUTPUT"
echo "Using APK: $APK_FILE"
- name: Validate Firebase service account secret
run: |
if [ -z "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" ]; then
echo "FIREBASE_SERVICE_ACCOUNT is not set. Add the Firebase service account JSON in repository secrets."
exit 1
fi
- name: Deploy to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: 1:422699885542:android:aab16ef8fc4e5968a0ec27
serviceCredentialsFileContent: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
groups: ${{ inputs.group }}
releaseNotes: ${{ github.event.inputs.release_notes }}
file: ${{ steps.resolve-apk.outputs.apk_file }}
# notify:
# name: Send Slack notifications
# runs-on: ubuntu-latest
# needs: [bump-version, deploy]
# if: success()
#
# steps:
# - name: Get git branch
# id: git-branch
# run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
#
# - name: Send Slack notification (main)
# uses: slackapi/slack-github-action@v1
# with:
# payload: |
# {
# "text": "A new Greenstand Beta Build has been released on Firebase",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "A new Greenstand Beta Build has been released on Firebase\n*Build Number:* ${{ needs.bump-version.outputs.version_code }}\n*Branch:* ${{ steps.git-branch.outputs.branch }}"
# }
# }
# ]
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_URL }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
#
# - name: Send Slack notification (QC)
# uses: slackapi/slack-github-action@v1
# with:
# payload: |
# {
# "text": "A new Greenstand Beta Build has been released on Firebase",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "A new Greenstand Beta Build has been released on Firebase\n*Build Number:* ${{ needs.bump-version.outputs.version_code }}\n*Branch:* ${{ steps.git-branch.outputs.branch }}"
# }
# }
# ]
# }
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_URL_QC }}
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK