-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upload mapping file to s3 (WPB-8774) (#3713)
Co-authored-by: Yamil Medina <[email protected]>
- Loading branch information
1 parent
3a09719
commit 36b2a87
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,57 @@ runs: | |
GITHUB_TOKEN: ${{ inputs.github-token }} | ||
run: | | ||
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" | ||
- name: Extract version and version code from APK filename | ||
shell: bash | ||
run: | | ||
filename=${{ steps.path.outputs.apk_full_path }} | ||
# Extract version name and version code | ||
version=$(echo "$filename" | sed -E 's/.*-v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | ||
version_code=$(echo "$filename" | sed -E 's/.*-([0-9]+)-${{ inputs.build-flavour }}-${{ inputs.build-variant }}\.apk/\1/') | ||
# Print the extracted version and version code | ||
echo "Extracted version: v$version" | ||
echo "Extracted version code: $version_code" | ||
# set them as environment variables for later use | ||
echo "VERSION=v$version" >> $GITHUB_ENV | ||
echo "VERSION_CODE=$version_code" >> $GITHUB_ENV | ||
- name: Rename mapping file | ||
if: ${{ inputs.build-variant != 'debug' }} | ||
shell: bash | ||
id: mapping | ||
run: | | ||
capitalized_variant=$(echo "${{ inputs.build-variant }}" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}') | ||
echo "Capitalized Variant: $capitalized_variant" | ||
mapping_full_path="app/build/outputs/mapping/${{ inputs.build-flavour }}${capitalized_variant}/mapping.txt" | ||
new_mapping_file_name="mapping-${{ env.VERSION }}-${{ env.VERSION_CODE }}-${{ inputs.build-flavour }}-${{ inputs.build-variant }}.txt" | ||
mv "$mapping_full_path" "$new_mapping_file_name" | ||
# Set the new mapping file name as an environment variable | ||
echo "new_mapping_file_name=$new_mapping_file_name" >> $GITHUB_ENV | ||
- name: Upload mapping file to S3 from branch | ||
if: ${{ github.event.pull_request.number == '' && inputs.build-variant != 'debug' }} | ||
id: upload-mapping-from-branch | ||
uses: hkusu/[email protected] | ||
with: | ||
aws-access-key-id: ${{ inputs.aws-access-key-id }} | ||
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} | ||
aws-region: 'eu-central-1' | ||
aws-bucket: ${{ inputs.aws-bucket }} | ||
destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/" | ||
file-path: ${{ env.new_mapping_file_name }} | ||
output-file-url: 'false' | ||
public: false | ||
- name: Upload mapping file to S3 from PR | ||
if: ${{ github.event.pull_request.number != '' && inputs.build-variant != 'debug' }} | ||
id: upload-mapping-from-PR | ||
uses: hkusu/[email protected] | ||
with: | ||
aws-access-key-id: ${{ inputs.aws-access-key-id }} | ||
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} | ||
aws-region: 'eu-central-1' | ||
aws-bucket: ${{ inputs.aws-bucket }} | ||
destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/PR-${{ github.event.pull_request.number }}/" | ||
file-path: ${{ env.new_mapping_file_name }} | ||
output-file-url: 'false' | ||
public: false |