Skip to content

Commit f4b6cd5

Browse files
AndrewGableOSBotify
authored andcommitted
Merge pull request #60387 from Expensify/Rory-FixReleaseCreation
[No QA] Fix Release Creation (cherry picked from commit 5a8d2ba) (CP triggered by AndrewGable)
1 parent 03e8859 commit f4b6cd5

3 files changed

Lines changed: 42 additions & 103 deletions

File tree

.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ async function run() {
2525
({data}, done) => {
2626
// For production deploys, look only at other production deploys.
2727
// staging deploys can be compared with other staging deploys or production deploys.
28-
// The reason is that the final staging release in each deploy cycle will BECOME a production release
2928
const filteredData = isProductionDeploy ? data.filter((release) => !release.prerelease) : data;
3029

3130
// Release was in the last page, meaning the previous release is the first item in this page

.github/actions/javascript/getDeployPullRequestList/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11518,7 +11518,6 @@ async function run() {
1151811518
}, ({ data }, done) => {
1151911519
// For production deploys, look only at other production deploys.
1152011520
// staging deploys can be compared with other staging deploys or production deploys.
11521-
// The reason is that the final staging release in each deploy cycle will BECOME a production release
1152211521
const filteredData = isProductionDeploy ? data.filter((release) => !release.prerelease) : data;
1152311522
// Release was in the last page, meaning the previous release is the first item in this page
1152411523
if (foundCurrentRelease) {

.github/workflows/deploy.yml

Lines changed: 42 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,14 @@ jobs:
285285
# v4
286286
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
287287
with:
288-
name: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'desktop-sourcemaps-artifact' || 'desktop-staging-sourcemaps-artifact' }}
288+
name: desktop-sourcemaps-artifact
289289
path: ./desktop/dist/www/merged-source-map.js.map
290290

291291
- name: Upload desktop build artifact
292292
# v4
293293
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
294294
with:
295-
name: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'desktop-build-artifact' || 'desktop-staging-build-artifact' }}
295+
name: desktop-build-artifact
296296
path: ./desktop-build/NewExpensify.dmg
297297

298298
ios:
@@ -516,7 +516,7 @@ jobs:
516516
# v4
517517
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
518518
with:
519-
name: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'web' || 'web-staging' }}-sourcemaps-artifact
519+
name: web-sourcemaps-artifact
520520
path: ./dist/merged-source-map.js.map
521521

522522
- name: Compress web build .tar.gz and .zip
@@ -528,14 +528,14 @@ jobs:
528528
# v4
529529
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
530530
with:
531-
name: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'web' || 'web-staging' }}-build-tar-gz-artifact
531+
name: web-build-tar-gz-artifact
532532
path: ./webBuild.tar.gz
533533

534534
- name: Upload .zip web build artifact
535535
# v4
536536
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
537537
with:
538-
name: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) && 'web' || 'web-staging' }}-build-zip-artifact
538+
name: web-build-zip-artifact
539539
path: ./webBuild.zip
540540

541541
postSlackMessageOnFailure:
@@ -588,97 +588,32 @@ jobs:
588588
echo "IS_ALL_PLATFORMS_DEPLOYED=$isAllPlatformsDeployed" >> "$GITHUB_OUTPUT"
589589
echo "IS_ALL_PLATFORMS_DEPLOYED is $isAllPlatformsDeployed"
590590
591-
createPrerelease:
591+
createRelease:
592592
runs-on: ubuntu-latest
593-
if: ${{ always() && github.ref == 'refs/heads/staging' && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
593+
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
594594
needs: [prep, checkDeploymentSuccess]
595595
steps:
596+
# v4.2.1
596597
- name: Download all workflow run artifacts
597-
# v4
598598
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
599599

600-
- name: 🚀 Create prerelease 🚀
600+
- name: 🚀 Create release 🚀
601601
run: |
602-
gh release create ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }} --title ${{ needs.prep.outputs.APP_VERSION }} --generate-notes --prerelease --verify-tag --target staging
602+
gh release create ${{ needs.prep.outputs.TAG }} ${{ github.ref == 'refs/heads/staging' && '--prerelease' }} \
603+
--repo ${{ github.repository }} \
604+
--title ${{ needs.prep.outputs.TAG }} \
605+
--generate-notes \
606+
--verify-tag \
607+
--target ${{ github.ref }}
603608
RETRIES=0
604-
MAX_RETRIES=10
609+
readonly MAX_RETRIES=10
605610
until [[ $(gh release view ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }}) || $RETRIES -ge $MAX_RETRIES ]]; do
606-
echo "release not found, retrying $((MAX_RETRIES - RETRIES++)) times"
611+
echo "Release not found, retrying $((MAX_RETRIES - RETRIES++)) times"
607612
sleep 1
608613
done
609614
env:
610615
GITHUB_TOKEN: ${{ github.token }}
611616

612-
- name: Rename web and desktop sourcemaps artifacts before assets upload in order to have unique ReleaseAsset.name
613-
continue-on-error: true
614-
run: |
615-
mv ./desktop-staging-sourcemaps-artifact/merged-source-map.js.map ./desktop-staging-sourcemaps-artifact/desktop-staging-merged-source-map.js.map
616-
mv ./web-staging-sourcemaps-artifact/merged-source-map.js.map ./web-staging-sourcemaps-artifact/web-staging-merged-source-map.js.map
617-
618-
- name: Upload artifacts to GitHub Release
619-
continue-on-error: true
620-
run: |
621-
# Release asset name should follow the template: [platform]-[staging, production or blank]-[sourcemap or blank].[file extension]
622-
files=(
623-
"./android-build-artifact/Expensify-release.aab#android.aab"
624-
"./android-apk-artifact/Expensify.apk#android.apk"
625-
"./android-sourcemap-artifact/index.android.bundle.map#android-sourcemap.js.map"
626-
"./desktop-staging-sourcemaps-artifact/desktop-staging-merged-source-map.js.map#desktop-staging-sourcemap.js.map"
627-
"./desktop-staging-build-artifact/NewExpensify.dmg#desktop-staging.dmg"
628-
"./ios-build-artifact/Expensify.ipa#ios.ipa"
629-
"./ios-sourcemap-artifact/main.jsbundle.map#ios-sourcemap.js.map"
630-
"./web-staging-sourcemaps-artifact/web-staging-merged-source-map.js.map#web-staging-sourcemap.js.map"
631-
"./web-staging-build-tar-gz-artifact/webBuild.tar.gz#web-staging.tar.gz"
632-
"./web-staging-build-zip-artifact/webBuild.zip#web-staging.zip"
633-
)
634-
635-
# Loop through each file and upload individually (so if one fails, we still have other platforms uploaded)
636-
for file_entry in "${files[@]}"; do
637-
gh release upload ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }} --clobber "$file_entry" || {
638-
echo "Failed to upload $file_entry. Continuing with the next file."
639-
continue
640-
}
641-
echo "Successfully uploaded $file_entry."
642-
done
643-
env:
644-
GITHUB_TOKEN: ${{ github.token }}
645-
646-
- name: Warn deployers if staging deploy failed
647-
if: ${{ failure() }}
648-
# v3
649-
uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e
650-
with:
651-
status: custom
652-
custom_payload: |
653-
{
654-
channel: '#deployer',
655-
attachments: [{
656-
color: "#DB4545",
657-
pretext: `<!subteam^S4TJJ3PSL>`,
658-
text: `💥 NewDot staging deploy failed. 💥`,
659-
}]
660-
}
661-
env:
662-
GITHUB_TOKEN: ${{ github.token }}
663-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
664-
665-
finalizeRelease:
666-
runs-on: ubuntu-latest
667-
if: ${{ always() && github.ref == 'refs/heads/production' && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
668-
needs: [prep, checkDeploymentSuccess]
669-
steps:
670-
- name: Download all workflow run artifacts
671-
# v4
672-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
673-
674-
- name: 🚀 Edit the release to be no longer a prerelease 🚀
675-
run: |
676-
LATEST_RELEASE="$(gh release list --repo ${{ github.repository }} --exclude-pre-releases --json tagName,isLatest --jq '.[] | select(.isLatest) | .tagName')"
677-
gh api --method POST /repos/Expensify/App/releases/generate-notes -f "tag_name=${{ needs.prep.outputs.TAG }}" -f "previous_tag_name=$LATEST_RELEASE" | jq -r '.body' >> releaseNotes.md
678-
gh release edit ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }} --prerelease=false --latest --notes-file releaseNotes.md
679-
env:
680-
GITHUB_TOKEN: ${{ github.token }}
681-
682617
- name: Rename web and desktop sourcemaps artifacts before assets upload in order to have unique ReleaseAsset.name
683618
continue-on-error: true
684619
run: |
@@ -688,27 +623,33 @@ jobs:
688623
- name: Upload artifacts to GitHub Release
689624
continue-on-error: true
690625
run: |
691-
# Release asset name should follow the template: [platform]-[staging, production or blank]-[sourcemap or blank].[file extension]
692-
files=(
693-
"./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-production-sourcemap.js.map"
694-
"./desktop-build-artifact/NewExpensify.dmg#desktop-production.dmg"
695-
"./web-sourcemaps-artifact/web-merged-source-map.js.map#web-production-sourcemap.js.map"
696-
"./web-build-tar-gz-artifact/webBuild.tar.gz#web-production.tar.gz"
697-
"./web-build-zip-artifact/webBuild.zip#web-production.zip"
698-
)
626+
# Release asset name should follow the template: fileNameOnRunner#fileNameInRelease
627+
files="
628+
./android-build-artifact/Expensify-release.aab#android.aab
629+
./android-apk-artifact/Expensify.apk#android.apk
630+
./android-sourcemap-artifact/index.android.bundle.map#android-sourcemap.js.map
631+
./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap.js.map
632+
./desktop-build-artifact/NewExpensify.dmg#desktop.dmg
633+
./ios-build-artifact/Expensify.ipa#ios.ipa
634+
./ios-sourcemap-artifact/main.jsbundle.map#ios-sourcemap.js.map
635+
./web-sourcemaps-artifact/web-merged-source-map.js.map#web-sourcemap.js.map
636+
./web-build-tar-gz-artifact/webBuild.tar.gz#web.tar.gz
637+
./web-build-zip-artifact/webBuild.zip#web.zip
638+
"
699639
700640
# Loop through each file and upload individually (so if one fails, we still have other platforms uploaded)
701-
for file_entry in "${files[@]}"; do
702-
gh release upload ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }} --clobber "$file_entry" || {
703-
echo "Failed to upload $file_entry. Continuing with the next file."
704-
continue
705-
}
706-
echo "Successfully uploaded $file_entry."
707-
done
641+
# Note: Not all of these files are present for production releases, because we don't build the native apps for prod deploys. That's expected.
642+
echo -e "$files" | xargs -I {} --max-procs=4 bash -c '
643+
if gh release upload ${{ needs.prep.outputs.TAG }} --repo ${{ github.repository }} --clobber {}; then
644+
echo "✅ Successfully uploaded {}"
645+
else
646+
echo "❌ Failed to upload {}"
647+
fi
648+
'
708649
env:
709650
GITHUB_TOKEN: ${{ github.token }}
710651

711-
- name: Warn deployers if production deploy failed
652+
- name: Warn deployers if deploy failed
712653
if: ${{ failure() }}
713654
# v3
714655
uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e
@@ -720,7 +661,7 @@ jobs:
720661
attachments: [{
721662
color: "#DB4545",
722663
pretext: `<!subteam^S4TJJ3PSL>`,
723-
text: `💥 NewDot production deploy failed. 💥`,
664+
text: `💥 NewDot ${{ github.ref == 'refs/heads/staging' && 'staging' || 'production' }} deploy failed. 💥`,
724665
}]
725666
}
726667
env:
@@ -731,7 +672,7 @@ jobs:
731672
name: Post a Slack message when all platforms deploy successfully
732673
runs-on: ubuntu-latest
733674
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_ALL_PLATFORMS_DEPLOYED) }}
734-
needs: [prep, android, desktop, ios, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
675+
needs: [prep, android, desktop, ios, web, checkDeploymentSuccess, createRelease]
735676
steps:
736677
- name: 'Announces the deploy in the #announce Slack room'
737678
# v3
@@ -788,7 +729,7 @@ jobs:
788729
postGithubComments:
789730
uses: ./.github/workflows/postDeployComments.yml
790731
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
791-
needs: [prep, android, desktop, ios, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
732+
needs: [prep, android, desktop, ios, web, checkDeploymentSuccess, createRelease]
792733
with:
793734
version: ${{ needs.prep.outputs.APP_VERSION }}
794735
env: ${{ github.ref == 'refs/heads/production' && 'production' || 'staging' }}

0 commit comments

Comments
 (0)