my fork of the bluesky client

use custom github action for fingerprinting (#4226)

* use custom github action for fingerprinting

* update pr workflow

* update names of workflows

* make a native change (testing)

* adjust the action

* Revert "make a native change (testing)"

This reverts commit 8db98357330c24b4ac89b795dc73e3d84a29d9af.

* update bundle-deploy script

* test a prod build

* crazy depth

* manually set

* use prod default

* force prod

* revert test changes

* save cache after deploy

* revert testing

authored by hailey.at and committed by

GitHub 5ceb440d adbbded0

+84 -87
+12
.github/workflows/build-submit-android.yml
··· 119 119 env: 120 120 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 121 121 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 122 + 123 + - name: ⬇️ Restore Cache 124 + id: get-base-commit 125 + uses: actions/cache@v4 126 + if: ${{ inputs.profile == 'testflight' && github.ref == 'refs/heads/main' }} 127 + with: 128 + path: most-recent-testflight-commit.txt 129 + key: most-recent-testflight-commit 130 + 131 + - name: ✏️ Write commit hash to cache 132 + if: ${{ inputs.profile == 'testflight' && github.ref == 'refs/heads/main' }} 133 + run: echo ${{ github.sha }} > most-recent-testflight-commit.txt
+12
.github/workflows/build-submit-ios.yml
··· 76 76 77 77 - name: 🚀 Deploy 78 78 run: eas submit -p ios --non-interactive --path build.ipa 79 + 80 + - name: ⬇️ Restore Cache 81 + id: get-base-commit 82 + uses: actions/cache@v4 83 + if: ${{ inputs.profile == 'testflight' && github.ref == 'refs/heads/main' }} 84 + with: 85 + path: most-recent-testflight-commit.txt 86 + key: most-recent-testflight-commit 87 + 88 + - name: ✏️ Write commit hash to cache 89 + if: ${{ inputs.profile == 'testflight' && github.ref == 'refs/heads/main' }} 90 + run: echo ${{ github.sha }} > most-recent-testflight-commit.txt
+49 -63
.github/workflows/bundle-deploy-eas-update.yml
··· 26 26 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-deploy 27 27 cancel-in-progress: true 28 28 outputs: 29 - fingerprint-is-different: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different }} 29 + changes-detected: ${{ steps.fingerprint.outputs.includes-changes }} 30 30 31 31 steps: 32 32 - name: Check for EXPO_TOKEN ··· 49 49 with: 50 50 fetch-depth: 0 51 51 52 - - name: ⬇️ Get last successful deployment commit from the cache 53 - id: get-base-commit 54 - uses: actions/cache@v4 55 - with: 56 - path: last-successful-commit-hash.txt 57 - key: last-successful-deployment-commit-${{ github.ref_name }}-${{ github.sha }} 58 - restore-keys: | 59 - last-successful-deployment-commit-${{ github.ref_name }}- 60 - 61 - - name: Add the last successful deployment commit to the output 62 - id: last-successful-commit 63 - run: echo base-commit=$(cat last-successful-commit-hash.txt) >> "$GITHUB_OUTPUT" 64 - 65 52 - name: ⬇️ Fetch commits from base branch 66 53 if: ${{ github.ref != 'refs/heads/main' }} 67 54 run: git fetch origin main:main --depth 100 68 55 69 - # This should get the current production release's commit's hash to see if the update is compatible 70 - - name: 🕵️ Get the base commit 71 - id: base-commit 72 - run: | 73 - if ${{ inputs.channel == 'production' }}; then 74 - echo base-commit=$(git show-ref -s ${{ inputs.runtimeVersion }}) >> "$GITHUB_OUTPUT" 75 - else 76 - echo base-commit=${{ steps.last-successful-commit.base-commit }} >> "$GITHUB_OUTPUT" 77 - fi 78 - 79 - - name: ✓ Make sure we found a base commit 80 - run: | 81 - if [ -z "${{ steps.base-commit.outputs.base-commit }}" && ${{ inputs.channel == 'production' }} ]; then 82 - echo "Could not find a base commit for this release. Exiting." 83 - exit 1 84 - fi 85 - 86 56 - name: 🔧 Setup Node 87 57 uses: actions/setup-node@v4 88 58 with: 89 59 node-version-file: .nvmrc 90 60 cache: yarn 91 61 92 - - name: ⚙️ Install Dependencies 93 - run: yarn install 94 - 95 - # Run the fingerprint 96 - - name: 📷 Check fingerprint 62 + - name: 📷 Check fingerprint and install dependencies 97 63 id: fingerprint 98 - uses: expo/expo-github-action/fingerprint@main 64 + uses: bluesky-social/github-actions/fingerprint-native@main 99 65 with: 100 - previous-git-commit: ${{ steps.base-commit.outputs.base-commit }} 101 - 102 - - name: 👀 Debug fingerprint 103 - id: fingerprint-debug 104 - run: | 105 - echo "previousGitCommit=${{ steps.fingerprint.outputs.previous-git-commit }} currentGitCommit=${{ steps.fingerprint.outputs.current-git-commit }}" 106 - echo "isPreviousFingerprintEmpty=${{ steps.fingerprint.outputs.previous-fingerprint == '' }}" 107 - 108 - fingerprintDiff='$(echo "${{ steps.fingerprint.outputs.fingerprint-diff }}")' 109 - 110 - if [[ $fingerprintDiff =~ "bareRncliAutolinking" || $fingerprintDiff =~ "expoAutolinkingAndroid" || $fingerprintDiff =~ "expoAutolinkingIos" ]]; then 111 - echo fingerprint-is-different="true" >> "$GITHUB_OUTPUT" 112 - else 113 - echo fingerprint-is-different="false" >> "$GITHUB_OUTPUT" 114 - fi 66 + profile: ${{ inputs.channel || 'testflight' }} 67 + previous-commit-tag: ${{ inputs.runtimeVersion }} 115 68 116 69 - name: Lint check 117 70 run: yarn lint ··· 127 80 128 81 - name: 🔨 Setup EAS 129 82 uses: expo/expo-github-action@v8 130 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 83 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 131 84 with: 132 85 expo-version: latest 133 86 eas-version: latest 134 87 token: ${{ secrets.EXPO_TOKEN }} 135 88 136 89 - name: ⛏️ Setup Expo 137 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 90 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 138 91 run: yarn global add eas-cli-local-build-plugin 139 92 140 93 - name: 🪛 Setup jq 141 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 94 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 142 95 uses: dcarbone/install-jq-action@v2 143 96 144 97 - name: ✏️ Write environment variables 145 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 98 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 146 99 run: | 147 100 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' 148 101 echo "${{ secrets.ENV_TOKEN }}" > .env ··· 151 104 echo "$json" > google-services.json 152 105 153 106 - name: 🏗️ Create Bundle 154 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 107 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 155 108 run: EXPO_PUBLIC_ENV="${{ inputs.channel || 'testflight' }}" yarn export 156 109 157 110 - name: 📦 Package Bundle and 🚀 Deploy 158 - if: ${{ steps.fingerprint-debug.outputs.fingerprint-is-different == 'false'}} 111 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 159 112 run: yarn use-build-number bash scripts/bundleUpdate.sh 160 113 env: 161 114 DENIS_API_KEY: ${{ secrets.DENIS_API_KEY }} 162 115 RUNTIME_VERSION: ${{ inputs.runtimeVersion }} 163 116 CHANNEL_NAME: ${{ inputs.channel || 'testflight' }} 164 117 165 - - name: Save successful deployment commit hash 166 - run: echo ${{ steps.fingerprint.outputs.current-git-commit }} > last-successful-commit-hash.txt 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 167 129 168 130 # GitHub actions are horrible so let's just copy paste this in 169 131 buildIfNecessaryIOS: ··· 171 133 runs-on: macos-14 172 134 concurrency: 173 135 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-build-ios 174 - cancel-in-progress: false 136 + cancel-in-progress: true 175 137 needs: [bundleDeploy] 176 138 # Gotta check if its NOT '[]' because any md5 hash in the outputs is detected as a possible secret and won't be 177 139 # available here 178 - if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.fingerprint-is-different == 'true' }} 140 + if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.changes-detected }} 179 141 steps: 180 142 - name: Check for EXPO_TOKEN 181 143 run: > ··· 237 199 238 200 - name: 🚀 Deploy 239 201 run: eas submit -p ios --non-interactive --path build.ipa 202 + 203 + - name: ⬇️ Restore Cache 204 + id: get-base-commit 205 + uses: actions/cache@v4 206 + if: ${{ inputs.channel == 'testflight' }} 207 + with: 208 + path: most-recent-testflight-commit.txt 209 + key: most-recent-testflight-commit 210 + 211 + - name: ✏️ Write commit hash to cache 212 + if: ${{ inputs.channel == 'testflight' }} 213 + run: echo ${{ github.sha }} > most-recent-testflight-commit.txt 240 214 241 215 buildIfNecessaryAndroid: 242 216 name: Build and Submit Android ··· 247 221 needs: [ bundleDeploy ] 248 222 # Gotta check if its NOT '[]' because any md5 hash in the outputs is detected as a possible secret and won't be 249 223 # available here 250 - if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.fingerprint-is-different == 'true' }} 224 + if: ${{ inputs.channel != 'production' && needs.bundleDeploy.outputs.changes-detected }} 251 225 252 226 steps: 253 227 - name: Check for EXPO_TOKEN ··· 325 299 env: 326 300 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }} 327 301 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 302 + 303 + - name: ⬇️ Restore Cache 304 + id: get-base-commit 305 + uses: actions/cache@v4 306 + if: ${{ inputs.channel == 'testflight' }} 307 + with: 308 + path: most-recent-testflight-commit.txt 309 + key: most-recent-testflight-commit 310 + 311 + - name: ✏️ Write commit hash to cache 312 + if: ${{ inputs.channel == 'testflight' }} 313 + run: echo ${{ github.sha }} > most-recent-testflight-commit.txt
+11 -24
.github/workflows/pull-request-commit.yml
··· 1 1 # Credit for fingerprint action https://github.com/expo/expo 2 2 # https://github.com/expo/expo/blob/main/.github/workflows/pr-labeler.yml 3 3 --- 4 - name: PR labeler 4 + name: PR Tests 5 5 6 6 on: 7 7 push: ··· 21 21 jobs: 22 22 webpack-analyzer: 23 23 runs-on: ubuntu-22.04 24 - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} 24 + if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}} 25 25 steps: 26 26 - name: ⬇️ Checkout 27 27 uses: actions/checkout@v4 ··· 94 94 | ${{ steps.get-diff.outputs.base_file_string }} | ${{ steps.get-diff.outputs.pr_file_string }} | ${{ steps.get-diff.outputs.diff_file_string }} (${{ steps.get-diff.outputs.percent }}%) | 95 95 --- 96 96 97 - test-suite-fingerprint: 97 + fingerprint-native: 98 98 runs-on: ubuntu-22.04 99 - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push' }} 100 - concurrency: fingerprint-${{ github.event_name != 'pull_request' && 'main' || github.run_id }} 99 + if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request'}} 101 100 steps: 102 101 - name: ⬇️ Checkout 103 102 uses: actions/checkout@v4 ··· 114 113 node-version-file: .nvmrc 115 114 cache: yarn 116 115 117 - - name: ⚙️ Install Dependencies 118 - run: yarn install 119 - 120 - - name: Get the base commit 121 - id: base-commit 122 - run: echo base-commit=$(git log -n 1 main --pretty=format:'%H') >> "$GITHUB_OUTPUT" 123 - 124 - - name: 📷 Check fingerprint 116 + - name: 📷 Check fingerprint and install dependencies 125 117 id: fingerprint 126 - uses: expo/expo-github-action/fingerprint@main 118 + uses: bluesky-social/github-actions/fingerprint-native@main 127 119 with: 128 - previous-git-commit: ${{ steps.base-commit.outputs.base-commit }} 129 - 130 - - name: 👀 Debug fingerprint 131 - run: | 132 - echo "previousGitCommit=${{ steps.fingerprint.outputs.previous-git-commit }} currentGitCommit=${{ steps.fingerprint.outputs.current-git-commit }}" 133 - echo "isPreviousFingerprintEmpty=${{ steps.fingerprint.outputs.previous-fingerprint == '' }}" 120 + profile: pull-request 134 121 135 122 - name: 💬 Drop a comment 136 123 uses: marocchino/sticky-pull-request-comment@v2 137 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' }} 124 + if: ${{ steps.fingerprint.outputs.includes-changes }} 138 125 with: 139 126 header: fingerprint-diff 140 127 message: | 141 - The Pull Request introduced fingerprint changes against the base commit: ${{ steps.fingerprint.outputs.previous-git-commit }} 128 + The Pull Request introduced fingerprint changes against the base commit: 142 129 <details><summary>Fingerprint diff</summary> 143 130 144 131 ```json 145 - ${{ steps.fingerprint.outputs.fingerprint-diff }} 132 + ${{ steps.fingerprint.outputs.diff }} 146 133 ``` 147 134 148 135 </details> ··· 152 139 153 140 - name: 💬 Delete comment 154 141 uses: marocchino/sticky-pull-request-comment@v2 155 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' }} 142 + if: ${{ !steps.fingerprint.outputs.includes-changes }} 156 143 with: 157 144 header: fingerprint-diff 158 145 delete: true