muhamedzeema / appgallery-deply-action

6 stars 7 forks source link

file path gets overriden during the upload #4

Closed dinisnunes1 closed 2 years ago

dinisnunes1 commented 2 years ago

I'm using this action to upload to AppGallery, the apk is uploaded but the filename is always overriden on AppGallery and is always shown as app-release.apk

Example of the used config

 - name: Deploy to Huawei App Gallery
   uses: muhamedzeema/appgallery-deply-action@main
   with:
      client-id: ${{secrets.HUAWEI_CLIENT_ID}}
      client-key: ${{secrets.HUAWEI_CLIENT_KEY}}
      app-id: ${{secrets.HUAWEI_APP_ID}}
      file-extension: "apk"
      file-path: "path/android_test_universal.apk"
      submit: false

Screenshot 2022-01-10 at 15 58 02

muhamedzeema commented 2 years ago

@dinisnunes1 I will check it tomorrow morning and get back to you

dinisnunes1 commented 2 years ago

@muhamedzeema I beleive it's this line https://github.com/muhamedzeema/appgallery-deply-action/blob/main/index.js#L130 as the file name is hardcoded.

dinisnunes1 commented 2 years ago

@muhamedzeema quick fix could be: Option 1

- name: Deploy to Huawei App Gallery
  uses: muhamedzeema/appgallery-deply-action@main
  with:
    client-id: ${{secrets.HUAWEI_CLIENT_ID}}
    client-key: ${{secrets.HUAWEI_CLIENT_KEY}}
    app-id: ${{secrets.HUAWEI_APP_ID}}
    file-extension: "apk"
    file-path: "apk/release/app-release.apk"
    file-name: "Example-of-my-app-file-name"
    submit: true

and then edit the function updateAppFileInfo

function updateAppFileInfo({ fileDestUrl, size, appId, clientId, token, fileName, fileExt }) {
  console.log("Update App File Info .... ⌛️");
  var binaryName = 'app-release'
  if (typeOf(fileName) != 'undefined' && fileName != '') {
      binaryName = fileName
  }
  var data = JSON.stringify({
    fileType: "5",
    files: [
      {
        fileName: `${binaryName}.${fileExt}`,
        fileDestUrl: fileDestUrl,
        size,
      },
    ],
  });

Option 2

muhamedzeema commented 2 years ago

@dinisnunes1 great ideas, would you like to make those changes and creating a PR for it ?

dinisnunes1 commented 2 years ago

@muhamedzeema opened the PR with the proposed changes. https://github.com/muhamedzeema/appgallery-deply-action/pull/5

muhamedzeema commented 2 years ago

Thank youuuu.

dinisnunes1 commented 2 years ago

@muhamedzeema can you create a tag for it?