Replace versionName with my own in AndroidManifest.xml using GithubActions in Xamarin solution

Viewed 86

We are migrating from TeamCity to Github Actions. My goal is to replace versionName and versionCode with my custom parameters. This it a part of TeamCity PowerShell script:

$changeVersionName = 'android:versionName="' +$buildNumber +'"';
$changeVersionCode = 'android:versionCode="' +$ApkNumber +'"';

(Get-Content .\MobileAccess\MobileAccess.Droid\Properties\AndroidManifest.xml) `
-replace 'android:versionName="\d+.\d+.\d+.\d+"', $changeVersionName `
    -replace 'android:versionCode="\d+"', $changeVersionCode |
  Out-File .\MobileAccess\MobileAccess.Droid\Properties\AndroidManifest.xml -Encoding UTF8

So I have tried to execute echo "::set-output name=manifestcontent::(Get-Content .\MobileAccess\MobileAccess.Droid\Properties\AndroidManifest.xml)" in .sh file in order to receive the content of AndroidManifest to main.yml workflow in order to make an artifact with this content and replace with my own versions. Currently the problem is that I haven`t even get the content of AndroidManifest. Seems to me it can not find this file at all.

Actual questions:
1. Was this flow correct for this task? If no, what should I have to do?
2. What was a mistake in .sh when I tried to find AndroidManifest file and read it?

0 Answers
Related