Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] [No QA] Update artifacts names and add "Rename sourcemaps artifacts" step #48737

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 38 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ jobs:
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: android-sourcemaps
name: android-sourcemaps-artifact
path: ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map

- name: Upload Android build artifact
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: android-build
name: android-build-artifact
path: ./android/app/build/outputs/bundle/productionRelease/app-production-release.aab

- name: Set current App version in Env
Expand Down Expand Up @@ -185,13 +185,13 @@ jobs:
- name: Upload desktop sourcemaps artifact
uses: actions/upload-artifact@v4
with:
name: desktop-sourcemaps
name: desktop-sourcemaps-artifact
path: ./desktop/dist/www/merged-source-map.js.map

- name: Upload desktop build artifact
uses: actions/upload-artifact@v4
with:
name: desktop-build
name: desktop-build-artifact
path: ./desktop-build/NewExpensify.dmg

iOS:
Expand Down Expand Up @@ -282,14 +282,14 @@ jobs:
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: ios-sourcemaps
name: ios-sourcemaps-artifact
path: ./main.jsbundle.map

- name: Upload iOS build artifact
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
uses: actions/upload-artifact@v4
with:
name: ios-build
name: ios-build-artifact
path: /Users/runner/work/App/App/New\ Expensify.ipa

- name: Warn deployers if iOS production deploy failed
Expand Down Expand Up @@ -389,7 +389,7 @@ jobs:
- name: Upload web sourcemaps artifact
uses: actions/upload-artifact@v4
with:
name: web-sourcemaps
name: web-sourcemaps-artifact
path: ./dist/merged-source-map.js.map

- name: Compress web build .tar.gz and .zip
Expand All @@ -400,13 +400,13 @@ jobs:
- name: Upload .tar.gz web build artifact
uses: actions/upload-artifact@v4
with:
name: web-build-tar-gz
name: web-build-tar-gz-artifact
path: ./webBuild.tar.gz

- name: Upload .zip web build artifact
uses: actions/upload-artifact@v4
with:
name: web-build-zip
name: web-build-zip-artifact
path: ./webBuild.zip

postSlackMessageOnFailure:
Expand Down Expand Up @@ -490,18 +490,23 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Rename web and desktop sourcemaps artifacts before assets upload in order to have unique ReleaseAsset.name
run: |
mv ./desktop-sourcemaps/merged-source-map.js.map ./desktop-sourcemaps/desktop-merged-source-map.js.map
mv ./web-sourcemaps/merged-source-map.js.map ./web-sourcemaps/web-merged-source-map.js.map

- name: Upload artifacts to GitHub Release
run: |
gh release upload ${{ env.STAGING_VERSION }} \
./android-sourcemaps/index.android.bundle.map#android-sourcemap-${{ env.STAGING_VERSION }} \
./android-build/app-production-release.aab \
./desktop-sourcemaps/merged-source-map.js.map#desktop-sourcemap-${{ env.STAGING_VERSION }} \
./desktop-build/NewExpensify.dmg \
./ios-sourcemaps/main.jsbundle.map#ios-sourcemap-${{ env.STAGING_VERSION }} \
./ios-build/New\ Expensify.ipa \
./web-sourcemaps/merged-source-map.js.map#web-sourcemap-${{ env.STAGING_VERSION }} \
./web-build-tar-gz/webBuild.tar.gz \
./web-build-zip/webBuild.zip
./android-sourcemaps-artifact/index.android.bundle.map#android-sourcemap-${{ env.STAGING_VERSION }} \
./android-build-artifact/app-production-release.aab \
./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap-${{ env.STAGING_VERSION }} \
./desktop-build-artifact/NewExpensify.dmg \
./ios-sourcemaps-artifact/main.jsbundle.map#ios-sourcemap-${{ env.STAGING_VERSION }} \
./ios-build-artifact/New\ Expensify.ipa \
./web-sourcemaps-artifact/web-merged-source-map.js.map#web-sourcemap-${{ env.STAGING_VERSION }} \
./web-build-tar-gz-artifact/webBuild.tar.gz \
./web-build-zip-artifact/webBuild.zip
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -528,20 +533,28 @@ jobs:
if: ${{ github.ref == 'refs/heads/production' && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
needs: [checkDeploymentSuccess]
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Checkout production branch
uses: actions/checkout@v4

- name: Get current app version
run: echo "PRODUCTION_VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"

- name: Download all workflow run artifacts
uses: actions/download-artifact@v4

- name: Rename web and desktop sourcemaps artifacts before assets upload in order to have unique ReleaseAsset.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the rename necessary after download? Shouldn't it already be called ./desktop-sourcemaps/desktop-merged-source-map.js.map at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Upload desktop sourcemaps artifact" step, we upload the file located at ./desktop/dist/www/merged-source-map.js.map as an artifact named desktop-sourcemaps-artifact.

When we download the artifact, the path of the extracted file will be ./desktop-sourcemaps-artifact/merged-source-map.js.map. The artifact's extraction process retains the same file name, but it places it inside the folder named after the artifact.

As a result, we end up with:

./desktop-sourcemaps-artifact/merged-source-map.js.map
and similarly, for the web artifact: ./web-sourcemaps-artifact/merged-source-map.js.map
The reason a rename is necessary after downloading is due to the conflict in file names when uploading release assets. The ReleaseAsset.name parameter uses the file name, which must be unique. Even though the files are uploaded with different labels (i.e., desktop and web), the underlying file names are the same (merged-source-map.js.map), causing a naming conflict during the upload process.

run: |
mv ./desktop-sourcemaps/merged-source-map.js.map ./desktop-sourcemaps/desktop-merged-source-map.js.map
mv ./web-sourcemaps/merged-source-map.js.map ./web-sourcemaps/web-merged-source-map.js.map

- name: Upload artifacts to GitHub Release
run: |
gh release upload ${{ env.STAGING_VERSION }} \
./desktop-sourcemaps/merged-source-map.js.map#desktop-sourcemap-${{ env.STAGING_VERSION }} \
./desktop-build/NewExpensify.dmg \
./web-sourcemaps/merged-source-map.js.map#web-sourcemap-${{ env.STAGING_VERSION }} \
./web-build-tar-gz/webBuild.tar.gz \
./web-build-zip/webBuild.zip
./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap-${{ env.STAGING_VERSION }} \
./desktop-build-artifact/NewExpensify.dmg \
./web-sourcemaps-artifact/web-merged-source-map.js.map#web-sourcemap-${{ env.STAGING_VERSION }} \
./web-build-tar-gz-artifact/webBuild.tar.gz \
./web-build-zip-artifact/webBuild.zip
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
Loading