my fork of the bluesky client
at main 317 lines 11 kB view raw
1--- 2name: Bundle and Deploy EAS Update 3 4on: 5 push: 6 branches: 7 - main 8 workflow_dispatch: 9 inputs: 10 channel: 11 type: choice 12 description: Deployment channel to use 13 options: 14 - testflight 15 - production 16 runtimeVersion: 17 type: string 18 description: Runtime version (in x.x.x format) that this update is for 19 required: true 20 21jobs: 22 bundleDeploy: 23 name: Bundle and Deploy EAS Update 24 runs-on: ubuntu-latest 25 concurrency: 26 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-deploy 27 cancel-in-progress: true 28 outputs: 29 changes-detected: ${{ steps.fingerprint.outputs.includes-changes }} 30 31 steps: 32 - name: Check for EXPO_TOKEN 33 run: > 34 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then 35 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" 36 exit 1 37 fi 38 39 # Validate the version if one is supplied. This should generally happen if the update is for a production client 40 - name: 🧐 Validate version 41 if: ${{ inputs.runtimeVersion }} 42 run: | 43 if [ -z "${{ inputs.runtimeVersion }}" ]; then 44 [[ "${{ inputs.runtimeVersion }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "Version is valid" || exit 1 45 fi 46 47 - name: ⬇️ Checkout 48 uses: actions/checkout@v4 49 with: 50 fetch-depth: 0 51 52 - name: ⬇️ Fetch commits from base branch 53 if: ${{ github.ref != 'refs/heads/main' }} 54 run: git fetch origin main:main --depth 100 55 56 - name: 🔧 Setup Node 57 uses: actions/setup-node@v4 58 with: 59 node-version-file: .nvmrc 60 cache: yarn 61 62 - name: 📷 Check fingerprint and install dependencies 63 id: fingerprint 64 uses: bluesky-social/github-actions/fingerprint-native@main 65 with: 66 profile: ${{ inputs.channel || 'testflight' }} 67 previous-commit-tag: ${{ inputs.runtimeVersion }} 68 69 - name: Lint check 70 run: yarn lint 71 72 - name: Prettier check 73 run: yarn prettier --check . 74 75 - name: Check & compile i18n 76 run: yarn intl:build 77 78 - name: Type check 79 run: yarn typecheck 80 81 - name: 🔨 Setup EAS 82 uses: expo/expo-github-action@v8 83 if: ${{ !steps.fingerprint.outputs.includes-changes }} 84 with: 85 expo-version: latest 86 eas-version: latest 87 token: ${{ secrets.EXPO_TOKEN }} 88 89 - name: ⛏️ Setup Expo 90 if: ${{ !steps.fingerprint.outputs.includes-changes }} 91 run: yarn global add eas-cli-local-build-plugin 92 93 - name: 🪛 Setup jq 94 if: ${{ !steps.fingerprint.outputs.includes-changes }} 95 uses: dcarbone/install-jq-action@v2 96 97 - name: ✏️ Write environment variables 98 if: ${{ !steps.fingerprint.outputs.includes-changes }} 99 run: | 100 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' 101 echo "${{ secrets.ENV_TOKEN }}" > .env 102 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env 103 echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env 104 echo "$json" > google-services.json 105 106 - name: 🏗️ Create Bundle 107 if: ${{ !steps.fingerprint.outputs.includes-changes }} 108 run: EXPO_PUBLIC_ENV="${{ inputs.channel || 'testflight' }}" yarn export 109 110 - name: 📦 Package Bundle and 🚀 Deploy 111 if: ${{ !steps.fingerprint.outputs.includes-changes }} 112 run: yarn use-build-number bash scripts/bundleUpdate.sh 113 env: 114 DENIS_API_KEY: ${{ secrets.DENIS_API_KEY }} 115 RUNTIME_VERSION: ${{ inputs.runtimeVersion }} 116 CHANNEL_NAME: ${{ inputs.channel || 'testflight' }} 117 118 - name: ⬇️ Restore Cache 119 id: get-base-commit 120 uses: actions/cache@v4 121 if: ${{ !steps.fingerprint.outputs.includes-changes }} 122 with: 123 path: most-recent-testflight-commit.txt 124 key: most-recent-testflight-commit 125 126 - name: ✏️ Write commit hash to cache 127 if: ${{ !steps.fingerprint.outputs.includes-changes }} 128 run: echo ${{ github.sha }} > most-recent-testflight-commit.txt 129 130 # GitHub actions are horrible so let's just copy paste this in 131 buildIfNecessaryIOS: 132 name: Build and Submit iOS 133 runs-on: macos-14 134 concurrency: 135 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-build-ios 136 cancel-in-progress: true 137 needs: [bundleDeploy] 138 # Gotta check if its NOT '[]' because any md5 hash in the outputs is detected as a possible secret and won't be 139 # available here 140 if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.changes-detected }} 141 steps: 142 - name: Check for EXPO_TOKEN 143 run: > 144 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then 145 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" 146 exit 1 147 fi 148 149 - name: ⬇️ Checkout 150 uses: actions/checkout@v4 151 with: 152 fetch-depth: 5 153 154 - name: 🔧 Setup Node 155 uses: actions/setup-node@v4 156 with: 157 node-version-file: .nvmrc 158 cache: yarn 159 160 - name: 🔨 Setup EAS 161 uses: expo/expo-github-action@v8 162 with: 163 expo-version: latest 164 eas-version: latest 165 token: ${{ secrets.EXPO_TOKEN }} 166 167 - name: ⛏️ Setup EAS local builds 168 run: yarn global add eas-cli-local-build-plugin 169 170 - name: ⚙️ Install dependencies 171 run: yarn install 172 173 - uses: maxim-lobanov/setup-xcode@v1 174 with: 175 xcode-version: '15.3' 176 177 - name: ☕️ Setup Cocoapods 178 uses: maxim-lobanov/setup-cocoapods@v1 179 with: 180 version: 1.14.3 181 182 - name: 💾 Cache Pods 183 uses: actions/cache@v3 184 id: pods-cache 185 with: 186 path: ./ios/Pods 187 # We'll use the yarn.lock for our hash since we don't yet have a Podfile.lock. Pod versions will not 188 # change unless the yarn version changes as well. 189 key: ${{ runner.os }}-pods-${{ hashFiles('yarn.lock') }} 190 191 - name: 🔤 Compile translations 192 run: yarn intl:build 193 194 - name: ✏️ Write environment variables 195 run: | 196 echo "${{ secrets.ENV_TOKEN }}" > .env 197 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env 198 echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env 199 echo "${{ secrets.GOOGLE_SERVICES_TOKEN }}" > google-services.json 200 201 - name: 🏗️ EAS Build 202 run: yarn use-build-number-with-bump eas build -p ios --profile testflight --local --output build.ipa --non-interactive 203 204 - name: 🚀 Deploy 205 run: eas submit -p ios --non-interactive --path build.ipa 206 207 - name: ⬇️ Restore Cache 208 id: get-base-commit 209 uses: actions/cache@v4 210 if: ${{ inputs.channel == 'testflight' }} 211 with: 212 path: most-recent-testflight-commit.txt 213 key: most-recent-testflight-commit 214 215 - name: ✏️ Write commit hash to cache 216 if: ${{ inputs.channel == 'testflight' }} 217 run: echo ${{ github.sha }} > most-recent-testflight-commit.txt 218 219 buildIfNecessaryAndroid: 220 name: Build and Submit Android 221 runs-on: ubuntu-latest 222 concurrency: 223 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-build-android 224 cancel-in-progress: false 225 needs: [ bundleDeploy ] 226 # Gotta check if its NOT '[]' because any md5 hash in the outputs is detected as a possible secret and won't be 227 # available here 228 if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.changes-detected }} 229 230 steps: 231 - name: Check for EXPO_TOKEN 232 run: > 233 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then 234 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" 235 exit 1 236 fi 237 238 - name: ⬇️ Checkout 239 uses: actions/checkout@v4 240 with: 241 fetch-depth: 5 242 243 - name: 🔧 Setup Node 244 uses: actions/setup-node@v4 245 with: 246 node-version-file: .nvmrc 247 cache: yarn 248 249 - name: 🔨 Setup EAS 250 uses: expo/expo-github-action@v8 251 with: 252 expo-version: latest 253 eas-version: latest 254 token: ${{ secrets.EXPO_TOKEN }} 255 256 - name: ⛏️ Setup EAS local builds 257 run: yarn global add eas-cli-local-build-plugin 258 259 - uses: actions/setup-java@v4 260 with: 261 distribution: 'temurin' 262 java-version: '17' 263 264 - name: ⚙️ Install dependencies 265 run: yarn install 266 267 - name: 🔤 Compile translations 268 run: yarn intl:build 269 270 - name: ✏️ Write environment variables 271 run: | 272 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' 273 echo "${{ secrets.ENV_TOKEN }}" > .env 274 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env 275 echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env 276 echo "$json" > google-services.json 277 278 - name: 🏗️ EAS Build 279 run: yarn use-build-number-with-bump eas build -p android --profile testflight-android --local --output build.apk --non-interactive 280 281 - name: ⏰ Get a timestamp 282 id: timestamp 283 uses: nanzm/get-time-action@master 284 with: 285 format: 'MM-DD-HH-mm-ss' 286 287 - name: 🚀 Upload Artifact 288 id: upload-artifact 289 uses: actions/upload-artifact@v4 290 with: 291 retention-days: 30 292 compression-level: 0 293 name: build-${{ steps.timestamp.outputs.time }}.apk 294 path: build.apk 295 296 - name: 🔔 Notify Slack 297 uses: slackapi/slack-github-action@v1.25.0 298 with: 299 payload: | 300 { 301 "text": "Android build is ready for testing. Download the artifact here: ${{ steps.upload-artifact.outputs.artifact-url }}" 302 } 303 env: 304 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 305 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 306 307 - name: ⬇️ Restore Cache 308 id: get-base-commit 309 uses: actions/cache@v4 310 if: ${{ inputs.channel != 'testflight' && inputs.channel != 'production' }} 311 with: 312 path: most-recent-testflight-commit.txt 313 key: most-recent-testflight-commit 314 315 - name: ✏️ Write commit hash to cache 316 if: ${{ inputs.channel != 'testflight' && inputs.channel != 'production' }} 317 run: echo ${{ github.sha }} > most-recent-testflight-commit.txt