From 363f5be8fff4bd68c3e45bb3ea6d0838486f9d94 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 9 Jun 2020 21:23:10 -0400 Subject: [PATCH] increment version for ios --- .github/scripts/ios/increment-version.ps1 | 26 +++++++++++++++++++++++ .github/scripts/ios/setup-keychain.ps1 | 1 - .github/workflows/build.yml | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/scripts/ios/increment-version.ps1 diff --git a/.github/scripts/ios/increment-version.ps1 b/.github/scripts/ios/increment-version.ps1 new file mode 100644 index 000000000..e72860a3c --- /dev/null +++ b/.github/scripts/ios/increment-version.ps1 @@ -0,0 +1,26 @@ +$rootPath = $env:GITHUB_WORKSPACE; +$buildNumber = 100 + [int]$env:GITHUB_RUN_NUMBER; + +$bitwardenInfo = $($rootPath + "/src/iOS/Info.plist"); +$extensionInfo = $($rootPath + "/src/iOS.Extension/Info.plist"); +$autofillInfo = $($rootPath + "/src/iOS.Autofill/Info.plist"); + +Write-Output "########################################" +Write-Output "##### Setting CFBundleVersion $buildNumber" +Write-Output "########################################" + +function Update-Version($file) { + $xml=New-Object XML; + $xml.Load($file); + + Select-Xml -xml $xml -XPath "//dict/key[. = 'CFBundleVersion']/following-sibling::string[1]" | + %{ + $_.Node.InnerXml = $buildNumber + } + + $xml.Save($file); +} + +Update-Version $bitwardenInfo +Update-Version $extensionInfo +Update-Version $autofillInfo diff --git a/.github/scripts/ios/setup-keychain.ps1 b/.github/scripts/ios/setup-keychain.ps1 index 30dae13df..de03df8a1 100644 --- a/.github/scripts/ios/setup-keychain.ps1 +++ b/.github/scripts/ios/setup-keychain.ps1 @@ -11,4 +11,3 @@ security set-keychain-settings -lut 1200 build.keychain security import $mobileKeyPath -k build.keychain -P $env:MOBILE_KEY_PASSWORD -T /usr/bin/codesign -T /usr/bin/security security import $distCertPath -k build.keychain -P $env:DIST_CERT_PASSWORD -T /usr/bin/codesign -T /usr/bin/security security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $env:KEYCHAIN_PASSWORD build.keychain -security find-identity -v -p codesigning diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14c0c98c8..20ef41f4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,6 +138,11 @@ jobs: env: DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }} + - name: Increment version + if: github.ref == 'refs/heads/master' + run: ./.github/scripts/ios/increment-version.ps1 + shell: pwsh + - name: Set up keychain if: github.ref == 'refs/heads/master' run: ./.github/scripts/ios/setup-keychain.ps1