Bluesky app fork with some witchin' additions 💫
at fcc401897119594c84e7fec04436eb380d75df39 197 lines 7.6 kB view raw
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 if: github.repository == 'bluesky-social/social-app' 17 name: Build and Submit Android 18 runs-on: Linux-x64-32core 19 steps: 20 - name: Check for EXPO_TOKEN 21 run: > 22 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then 23 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" 24 exit 1 25 fi 26 27 - name: ⬇️ Checkout 28 uses: actions/checkout@v4 29 with: 30 fetch-depth: 5 31 32 - name: 🔧 Setup Node 33 uses: actions/setup-node@v6 34 with: 35 node-version-file: .nvmrc 36 cache: yarn 37 38 - name: 🪛 Setup jq 39 uses: dcarbone/install-jq-action@v2 40 41 - name: 🔨 Setup EAS 42 uses: expo/expo-github-action@main 43 with: 44 expo-version: latest 45 eas-version: latest 46 token: ${{ secrets.EXPO_TOKEN }} 47 48 - name: ⛏️ Setup EAS local builds 49 run: yarn global add eas-cli-local-build-plugin 50 51 - uses: actions/setup-java@v4 52 with: 53 distribution: "temurin" 54 java-version: "17" 55 56 - name: ⚙️ Install dependencies 57 run: yarn install --frozen-lockfile 58 59 - name: 🔤 Compile translations 60 run: yarn intl:build 2>&1 | tee i18n.log 61 62 - name: Check for i18n compilation errors 63 run: if grep -q "invalid syntax" "i18n.log"; then echo "\n\nFound compilation errors!\n\n" && exit 1; else echo "\n\nNo compilation errors!\n\n"; fi 64 65 # EXPO_PUBLIC_ENV is handled in eas.json 66 - name: Env 67 id: env 68 run: | 69 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' 70 echo "${{ secrets.ENV_TOKEN }}" > .env 71 echo "EXPO_PUBLIC_RELEASE_VERSION=$(jq -r '.version' package.json)" >> .env 72 echo "EXPO_PUBLIC_RELEASE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT 73 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse HEAD)" >> .env 74 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT 75 echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env 76 echo "EXPO_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env 77 echo "EXPO_PUBLIC_BITDRIFT_API_KEY=${{ secrets.BITDRIFT_API_KEY }}" >> .env 78 echo "EXPO_PUBLIC_GCP_PROJECT_ID=${{ secrets.EXPO_PUBLIC_GCP_PROJECT_ID }}" >> .env 79 echo "$json" > google-services.json 80 81 - name: 🏗️ EAS Build 82 run: > 83 SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} 84 SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }} 85 SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }} 86 yarn use-build-number-with-bump 87 eas build -p android 88 --profile ${{ inputs.profile || 'testflight-android' }} 89 --local --output build.aab --non-interactive 90 91 - name: ✍️ Rename Testflight bundle 92 if: ${{ inputs.profile != 'production' }} 93 run: mv build.aab build.apk 94 95 - name: ⏰ Get a timestamp 96 id: timestamp 97 uses: nanzm/get-time-action@master 98 with: 99 format: "MM-DD-HH-mm-ss" 100 101 - name: 🚀 Upload Production Artifact 102 id: upload-artifact-production 103 if: ${{ inputs.profile == 'production' }} 104 uses: actions/upload-artifact@v4 105 with: 106 retention-days: 30 107 compression-level: 6 108 name: build-${{ steps.timestamp.outputs.time }}.aab 109 path: build.aab 110 111 - name: 🚀 Upload Testflight Artifact 112 id: upload-artifact-testflight 113 if: ${{ inputs.profile != 'production' }} 114 uses: actions/upload-artifact@v4 115 with: 116 retention-days: 30 117 compression-level: 6 118 name: build-${{ steps.timestamp.outputs.time }}.apk 119 path: build.apk 120 121 - name: 📚 Get version from package.json 122 id: get-build-info 123 run: bash scripts/setGitHubOutput.sh 124 125 - name: 🔔 Notify Slack of Production Build 126 if: ${{ inputs.profile == 'production' }} 127 uses: slackapi/slack-github-action@v1.25.0 128 with: 129 payload: | 130 { 131 "text": "Android production build for Google Play Store submission is ready!\n```Artifact: ${{ steps.upload-artifact-production.outputs.artifact-url }}\nVersion Number: ${{ steps.get-build-info.outputs.PACKAGE_VERSION }}\nBuild Number: ${{ steps.get-build-info.outputs.BSKY_ANDROID_VERSION_CODE }}```" 132 } 133 env: 134 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 135 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 136 137 - name: 🔔 Notify Slack of Testflight Build 138 if: ${{ inputs.profile != 'production' }} 139 uses: slackapi/slack-github-action@v1.25.0 140 with: 141 payload: | 142 { 143 "text": "Android build is ready for testing. Download the artifact here: ${{ steps.upload-artifact-testflight.outputs.artifact-url }}" 144 } 145 env: 146 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 147 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 148 149 - name: 🧹 Clear Metro cache 150 if: ${{ inputs.profile == 'production' }} 151 # https://github.com/expo/eas-cli/issues/2959#issuecomment-2749791326 152 run: rm -rf ${TMPDIR:-/tmp}/metro-cache 153 154 - name: 🏗️ Build Production APK 155 if: ${{ inputs.profile == 'production' }} 156 run: > 157 SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} 158 SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }} 159 SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }} 160 yarn use-build-number-with-bump 161 eas build -p android 162 --profile production-apk 163 --local --output build.apk --non-interactive 164 165 - name: 🚀 Upload Production APK Artifact 166 id: upload-artifact-production-apk 167 if: ${{ inputs.profile == 'production' }} 168 uses: actions/upload-artifact@v4 169 with: 170 retention-days: 30 171 compression-level: 6 172 name: build-${{ steps.timestamp.outputs.time }}.apk 173 path: build.apk 174 175 - name: 🔔 Notify Slack of Production APK Build 176 if: ${{ inputs.profile == 'production' }} 177 uses: slackapi/slack-github-action@v1.25.0 178 with: 179 payload: | 180 { 181 "text": "Android production build for GitHub/Obtanium is ready!\n```Artifact: ${{ steps.upload-artifact-production-apk.outputs.artifact-url }}\nVersion Number: ${{ steps.get-build-info.outputs.PACKAGE_VERSION }}\nBuild Number: ${{ steps.get-build-info.outputs.BSKY_ANDROID_VERSION_CODE }}```" 182 } 183 env: 184 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 185 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 186 187 - name: ⬇️ Restore Cache 188 id: get-base-commit 189 uses: actions/cache@v4 190 if: ${{ inputs.profile == 'testflight-android' }} 191 with: 192 path: most-recent-testflight-commit.txt 193 key: most-recent-testflight-commit 194 195 - name: ✏️ Write commit hash to cache 196 if: ${{ inputs.profile == 'testflight-android' }} 197 run: echo ${{ github.sha }} > most-recent-testflight-commit.txt