diff --git a/.github/bash_scripts/pre_release.sh b/.github/bash_scripts/pre_release.sh index 8d9281b..8089ade 100644 --- a/.github/bash_scripts/pre_release.sh +++ b/.github/bash_scripts/pre_release.sh @@ -1,13 +1,17 @@ #!/bin/bash appsflyerLibVersion=$1 +rcVersion=$2 sed -i '' "s/version_appsflyerLib = \'.*\'/version_appsflyerLib = \'$appsflyerLibVersion\'/g" segment-appsflyer-ios.podspec +sed -i '' "s/version_plugin = \'.*\'/version_plugin = \'$rcVersion\'/g" segment-appsflyer-ios.podspec +sed -i '' "s/s.name = \"segment-appsflyer-ios\"/s.name = \"segment-appsflyer-ios-qa\"/g" segment-appsflyer-ios.podspec +mv segment-appsflyer-ios.podspec segment-appsflyer-ios-qa.podspec sed -r -i '' "s/(.*AppsFlyerLib.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerLibVersion\3/g" Package.swift -sed -r -i '' "s/(.*pod \'segment-appsflyer-ios\')(.*\'[0-9]+\.[0-9]+\.[0-9]+\')/\1,:podspec => \'\.\.\/\.\.\/segment-appsflyer-ios.podspec\'/g" examples/SwiftPodsSample/Podfile -sed -r -i '' "s/(.*pod \'segment-appsflyer-ios\')(.*\'[0-9]+\.[0-9]+\.[0-9]+\')/\1,:podspec => \'\.\.\/\.\.\/segment-appsflyer-ios.podspec\'/g" examples/ObjcPodsSample/Podfile +sed -r -i '' "s/(.*pod \'segment-appsflyer-ios)\'(.*\'[0-9]+\.[0-9]+\.[0-9]+\')/\1\',\'$rcVersion\'/g" examples/SwiftPodsSample/Podfile +sed -r -i '' "s/(.*pod \'segment-appsflyer-ios)\'(.*\'[0-9]+\.[0-9]+\.[0-9]+\')/\1\',\'$rcVersion\'/g" examples/ObjcPodsSample/Podfile sed -r -i '' "s/(## This is a Segment wrapper for AppsFlyer SDK that is built with iOS SDK v)(.*)/\1$appsflyerLibVersion./g" README.md sed -r -i '' "s/(.*pod \'segment-appsflyer-ios.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerLibVersion\3/g" README.md diff --git a/.github/bash_scripts/release.sh b/.github/bash_scripts/release.sh index a99f077..9944fa2 100644 --- a/.github/bash_scripts/release.sh +++ b/.github/bash_scripts/release.sh @@ -2,10 +2,12 @@ releaseVersion=$1 -sed -r -i '' "s/version_plugin = \'[0-9]+\.[0-9]+\.[0-9]+\'/version_plugin = \'$releaseVersion\'/g" segment-appsflyer-ios.podspec +sed -r -i '' "s/version_plugin = \'[0-9]+\.[0-9]+\.[0-9]+.*\'/version_plugin = \'$releaseVersion\'/g" segment-appsflyer-ios-qa.podspec +sed -i '' "s/s.name = \"segment-appsflyer-ios-qa\"/s.name = \"segment-appsflyer-ios\"/g" segment-appsflyer-ios-qa.podspec +mv segment-appsflyer-ios-qa.podspec segment-appsflyer-ios.podspec -sed -r -i '' "s/(.*pod \'segment-appsflyer-ios\')(.*)/\1,\'$releaseVersion\'/g" examples/SwiftPodsSample/Podfile -sed -r -i '' "s/(.*pod \'segment-appsflyer-ios\')(.*)/\1,\'$releaseVersion\'/g" examples/ObjcPodsSample/Podfile +sed -r -i '' "s/(.*pod \'segment-appsflyer-ios)-qa\'(.*)/\1\',\'$releaseVersion\'/g" examples/SwiftPodsSample/Podfile +sed -r -i '' "s/(.*pod \'segment-appsflyer-ios)-qa\'(.*)/\1\',\'$releaseVersion\'/g" examples/ObjcPodsSample/Podfile sed -i '' 's/^/* /' "releasenotes.$releaseVersion" NEW_VERSION_RELEASE_NOTES=$(cat "releasenotes.$releaseVersion") diff --git a/.github/workflows/prepare-for-QA-release.yml b/.github/workflows/prepare-for-QA-&-release.yml similarity index 51% rename from .github/workflows/prepare-for-QA-release.yml rename to .github/workflows/prepare-for-QA-&-release.yml index 1e8b617..0a91725 100644 --- a/.github/workflows/prepare-for-QA-release.yml +++ b/.github/workflows/prepare-for-QA-&-release.yml @@ -4,23 +4,35 @@ on: workflow_call: jobs: - Change-HardCoded-Version: + Change-HardCoded-Version-And-Then-Release: name: Pre Release - runs-on: macos-latest + runs-on: [ios, self-hosted] steps: - name: Checkout uses: actions/checkout@v3 - name: Determine release tag and release branch run: | + echo ${{github.ref_name}} TAG=$(echo "${{github.ref_name}}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+') - echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV + echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV + TAG_RC=$(echo "${{github.ref_name}}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+-rc[0-9]+') + echo "PLUGIN_VERSION_RC=$TAG_RC" >> $GITHUB_ENV + - name: run script - run: bash .github/bash_scripts/pre_release.sh ${{env.PLUGIN_VERSION}} + run: bash .github/bash_scripts/pre_release.sh ${{env.PLUGIN_VERSION}} ${{env.PLUGIN_VERSION_RC}} - name: Commit changes uses: EndBug/add-and-commit@v9 with: author_name: Moris Gateno author_email: moris.gateno@appsflyer.com message: 'Commited from github action - prepaing the repo for QA locally.' - add: '.' + add: '.' + tag: "${{env.PLUGIN_VERSION_RC}} --force" + tag_push: '--force' + - name: Push to COCOAPODS + run: | + pod trunk me + pod trunk push segment-appsflyer-ios-qa.podspec + + diff --git a/.github/workflows/prepare-for-release-workflow.yml b/.github/workflows/prepare-for-release-workflow.yml index 99bd4bc..935bfae 100644 --- a/.github/workflows/prepare-for-release-workflow.yml +++ b/.github/workflows/prepare-for-release-workflow.yml @@ -6,7 +6,6 @@ on: - opened branches: - 'master' - # - 'dev/add-release-workflow' jobs: Prepare-Plugin-For-Production: diff --git a/.github/workflows/release-QA-workflow.yml b/.github/workflows/release-QA-workflow.yml index c1dfe27..f5d0fd0 100644 --- a/.github/workflows/release-QA-workflow.yml +++ b/.github/workflows/release-QA-workflow.yml @@ -25,7 +25,8 @@ jobs: if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false' uses: ./.github/workflows/unit-tests-workflow.yml - Deploy-Locally-To-QA: - needs: [Run-Unit-Tests,Check-If-ReleaseNotes-Pushed] + Prepere-To-QA-&-Release: + needs: [Check-If-ReleaseNotes-Pushed] if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false' - uses: ./.github/workflows/prepare-for-QA-release.yml + uses: ./.github/workflows/prepare-for-QA-&-release.yml + diff --git a/.github/workflows/release-production-workflow.yml b/.github/workflows/release-production-workflow.yml index 0eeed02..8faa53e 100644 --- a/.github/workflows/release-production-workflow.yml +++ b/.github/workflows/release-production-workflow.yml @@ -11,7 +11,7 @@ on: jobs: Deploy-To-Production: if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/') - runs-on: macos-latest + runs-on: [ios, self-hosted] steps: - name: Checkout uses: actions/checkout@v3 @@ -49,9 +49,9 @@ jobs: - name: Install Cocoapods run: gem install cocoapods - name: Push to COCOAPODS - uses: michaelhenry/deploy-to-cocoapods-github-action@1.0.10 - env: - COCOAPODS_TRUNK_TOKEN: ${{ secrets.CI_COCOAPODS_TOKEN }} + run: | + pod trunk me + pod trunk push segment-appsflyer-ios.podspec - name: Notify with SLack uses: slackapi/slack-github-action@v1.23.0 with: