Skip to content

Commit cb1b34d

Browse files
committed
calculate sha56 and export it
1 parent 4847223 commit cb1b34d

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

.github/workflows/_reusable_app_release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ jobs:
211211
id: base64-decoded-S3_PATHS
212212
with:
213213
base64: ${{ env.S3_PATHS }}
214+
- uses: akiojin/decode-base64-github-action@v1.0.2
215+
id: base64-decoded-BUILD_INSTALL_LINK
216+
with:
217+
base64: ${{ env.BUILD_INSTALL_LINK }}
218+
- name: Print Install URL and SHA56
219+
run: |
220+
echo "Install URL: $BUILD_INSTALL_LINK"
221+
echo "Install URL decoded: $steps.base64-decoded-BUILD_INSTALL_LINK"
222+
echo "SHA-256: $BUILD_SHA256"
214223
- name: Notify on Wire if succeeded
215224
if: success()
216225
uses: 8398a7/action-slack@v3
@@ -225,7 +234,7 @@ jobs:
225234
**AWS S3 Paths:**\n`${{ steps.base64-decoded-S3_PATHS.outputs.decoded }}`
226235
**Triggered by:** ${{ github.triggering_actor }}
227236
**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
228-
**SHA256: ${{ env.SHA256 }}
237+
**SHA256: ${{ env.BUILD_SHA256 }}
229238
- name: Notify on Wire if failed
230239
if: failure()
231240
uses: 8398a7/action-slack@v3

fastlane/Fastfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,10 @@ platform :ios do
627627
app_name = build.app_center_app_name
628628
end
629629

630-
sh "echo SHA of IPA is:"
631-
sh "shasum -a 256 ../#{build.artifact_path(with_filename: true)}.ipa || true"
630+
# Calculate SHA-256 for the local IPA file
631+
ipa_path = "../#{build.artifact_path(with_filename: true)}.ipa"
632+
sha256 = `shasum -a 256 #{ipa_path} | awk '{print $1}'`.strip
633+
UI.message("SHA-256 of IPA is: #{sha256}")
632634

633635
appcenter_upload(
634636
api_token: ENV["APPCENTER_API_TOKEN"],
@@ -641,8 +643,16 @@ platform :ios do
641643
dsym: "#{build.artifact_path(with_filename: true)}.app.dSYM.zip"
642644
)
643645

646+
# Fetch install URL after upload
644647
appcenter_build_info = Fastlane::Actions.lane_context[:APPCENTER_BUILD_INFORMATION]
645-
`export TEMP='BUILD_INSTALL_LINK=#{appcenter_build_info['install_url']}' && echo $TEMP >> ./.post_build/.env`
648+
install_url = appcenter_build_info['install_url']
649+
650+
# Export SHA-256 and INSTALL_LINK to .post_build/.env file
651+
export_env_path = "./.post_build/.env"
652+
FileUtils.mkdir_p("./.post_build")
653+
654+
sh "export TEMP='BUILD_INSTALL_LINK=#{install_url}' && echo $TEMP >> #{export_env_path}"
655+
sh "export TEMP='BUILD_SHA256=#{sha256}' && echo $TEMP >> #{export_env_path}"
646656
end
647657

648658
# Upload to S3 (Automation builds)

0 commit comments

Comments
 (0)