mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1---
2name: Build and Submit Android
3
4on:
5 workflow_dispatch:
6 inputs:
7 profile:
8 type: choice
9 description: Build profile to use
10 options:
11 - testflight-android
12 - production
13
14jobs:
15 build:
16 name: Build and Submit Android
17 runs-on: ubuntu-latest
18 steps:
19 - name: Check for EXPO_TOKEN
20 run: >
21 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
22 echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
23 exit 1
24 fi
25
26 - name: ⬇️ Checkout
27 uses: actions/checkout@v4
28
29 - name: 🔧 Setup Node
30 uses: actions/setup-node@v4
31 with:
32 node-version-file: .nvmrc
33 cache: yarn
34
35 - name: 🔨 Setup EAS
36 uses: expo/expo-github-action@v8
37 with:
38 expo-version: latest
39 eas-version: latest
40 token: ${{ secrets.EXPO_TOKEN }}
41
42 - name: ⛏️ Setup EAS local builds
43 run: yarn global add eas-cli-local-build-plugin
44
45 - uses: actions/setup-java@v4
46 with:
47 distribution: 'temurin'
48 java-version: '17'
49
50 - name: ⚙️ Install dependencies
51 run: yarn install
52
53 - name: 🔤 Compile translations
54 run: yarn intl:build
55
56 - name: ✏️ Write environment variables
57 run: |
58 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
59 echo "${{ secrets.ENV_TOKEN }}" > .env
60 echo "$json" > google-services.json
61
62 - name: 🏗️ EAS Build
63 run: yarn use-build-number-with-bump eas build -p android --profile ${{ inputs.profile || 'testflight-android' }} --local --output build.aab --non-interactive
64
65 - name: ✍️ Rename Testflight bundle
66 if: ${{ inputs.profile != 'production' }}
67 run: mv build.aab build.apk
68
69 - name: ⏰ Get a timestamp
70 id: timestamp
71 uses: nanzm/get-time-action@master
72 with:
73 format: 'MM-DD-HH-mm-ss'
74
75 - name: 🚀 Upload Production Artifact
76 id: upload-artifact-production
77 if: ${{ inputs.profile == 'production' }}
78 uses: actions/upload-artifact@v4
79 with:
80 retention-days: 30
81 compression-level: 6
82 name: build-${{ steps.timestamp.outputs.time }}.aab
83 path: build.aab
84
85 - name: 🚀 Upload Testflight Artifact
86 id: upload-artifact-testflight
87 if: ${{ inputs.profile != 'production' }}
88 uses: actions/upload-artifact@v4
89 with:
90 retention-days: 30
91 compression-level: 6
92 name: build-${{ steps.timestamp.outputs.time }}.apk
93 path: build.apk
94
95 - name: 🔔 Notify Slack of Production Build
96 if: ${{ inputs.profile == 'production' }}
97 uses: slackapi/slack-github-action@v1.25.0
98 with:
99 payload: |
100 {
101 "text": "Android build is ready for submission. This is a production build! Download the artifact here: ${{ steps.upload-artifact-production.outputs.artifact-url }}"
102 }
103 env:
104 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }}
105 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
106
107 - name: 🔔 Notify Slack of Testflight Build
108 if: ${{ inputs.profile != 'production' }}
109 uses: slackapi/slack-github-action@v1.25.0
110 with:
111 payload: |
112 {
113 "text": "Android build is ready for testing. Download the artifact here: ${{ steps.upload-artifact-testflight.outputs.artifact-url }}"
114 }
115 env:
116 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }}
117 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK