|
64 | 64 | GITHUB_TOKEN:${{ inputs.github-token }}
|
65 | 65 | run:|
|
66 | 66 | gh pr comment "${{ github.event.pull_request.number }}" --body "Built [wire-android-${{ inputs.build-flavour }}-${{ inputs.build-variant }}-pr-${{ github.event.pull_request.number }}.apk](${{ steps.upload.outputs.file-url }}) is available for download"
|
| 67 | + -name:Extract version and version code from APK filename |
| 68 | +shell:bash |
| 69 | +run:| |
| 70 | + filename=${{ steps.path.outputs.apk_full_path }} |
| 71 | +
|
| 72 | + # Extract version name and version code |
| 73 | + version=$(echo "$filename" | sed -E 's/.*-v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') |
| 74 | + version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-${{ inputs.build-flavour }}-${{ inputs.build-variant }}\.apk/\1/') |
| 75 | +
|
| 76 | + # Print the extracted version and version code |
| 77 | + echo "Extracted version: v$version" |
| 78 | + echo "Extracted version code: $version_code" |
| 79 | +
|
| 80 | + # set them as environment variables for later use |
| 81 | + echo "VERSION=v$version" >> $GITHUB_ENV |
| 82 | + echo "VERSION_CODE=$version_code" >> $GITHUB_ENV |
| 83 | + -name:Rename mapping file |
| 84 | +if:${{ inputs.build-variant != 'debug' }} |
| 85 | +shell:bash |
| 86 | +id:mapping |
| 87 | +run:| |
| 88 | + capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') |
| 89 | + echo "Capitalized Variant: $capitalized_variant" |
| 90 | + mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" |
| 91 | + new_mapping_file_name="mapping-${{ env.VERSION }}-${{ env.VERSION_CODE }}-${{ inputs.build-flavour }}-${{ inputs.build-variant }}.txt" |
| 92 | + mv "$mapping_full_path" "$new_mapping_file_name" |
| 93 | + # Set the new mapping file name as an environment variable |
| 94 | + echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV |
| 95 | + -name:Upload mapping file to S3 from branch |
| 96 | +if:${{ github.event.pull_request.number == '' && inputs.build-variant != 'debug' }} |
| 97 | +id:upload-mapping-from-branch |
| 98 | +uses:hkusu/s3-upload-action@v2.1.0 |
| 99 | +with: |
| 100 | +aws-access-key-id:${{ inputs.aws-access-key-id }} |
| 101 | +aws-secret-access-key:${{ inputs.aws-secret-access-key }} |
| 102 | +aws-region:'eu-central-1' |
| 103 | +aws-bucket:${{ inputs.aws-bucket }} |
| 104 | +destination-dir:"megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/" |
| 105 | +file-path:${{ env.new_mapping_file_name }} |
| 106 | +output-file-url:'false' |
| 107 | +public:false |
| 108 | + -name:Upload mapping file to S3 from PR |
| 109 | +if:${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} |
| 110 | +id:upload-mapping-from-PR |
| 111 | +uses:hkusu/s3-upload-action@v2.1.0 |
| 112 | +with: |
| 113 | +aws-access-key-id:${{ inputs.aws-access-key-id }} |
| 114 | +aws-secret-access-key:${{ inputs.aws-secret-access-key }} |
| 115 | +aws-region:'eu-central-1' |
| 116 | +aws-bucket:${{ inputs.aws-bucket }} |
| 117 | +destination-dir:"megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/PR-${{ github.event.pull_request.number }}/" |
| 118 | +file-path:${{ env.new_mapping_file_name }} |
| 119 | +output-file-url:'false' |
| 120 | +public:false |