Skip to content

Commit

Permalink
Merge pull request #14 from AppsFlyerSDK/dev/DELIVERY-63759/create-ci
Browse files Browse the repository at this point in the history
Dev/delivery 63759/create ci
  • Loading branch information
morisgateno-appsflyer authored Jun 16, 2024
2 parents 53b52d9 + 8d02304 commit 8b75a25
Show file tree
Hide file tree
Showing 10 changed files with 247 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/bash_scripts/podfile_creation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
echo "# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'segment-appsflyer-ios' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for segment-appsflyer-ios
pod 'Analytics'
pod 'AppsFlyerFramework'
end
target 'SegmentAppsFlyeriOSTests' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for SegmentAppsFlyeriOSTests
pod 'OCMock'
end" > Podfile

19 changes: 19 additions & 0 deletions .github/bash_scripts/pre_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

appsflyerLibVersion=$1
rcVersion=$2

sed -i '' "s/version_appsflyerLib = \'.*\'/version_appsflyerLib = \'$appsflyerLibVersion\'/g" AppsFlyerAdobeAEPExtension.podspec
sed -i '' "s/version_plugin = \'.*\'/version_plugin = \'$rcVersion\'/g" AppsFlyerAdobeAEPExtension.podspec
sed -i '' "s/s.name = \'AppsFlyerAdobeAEPExtension\'/s.name = \'AppsFlyerAdobeAEPExtension-qa\'/g" AppsFlyerAdobeAEPExtension.podspec
mv AppsFlyerAdobeAEPExtension.podspec AppsFlyerAdobeAEPExtension-qa.podspec

sed -r -i '' "s/(.*AppsFlyerLib.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerLibVersion\3/g" Package.swift

sed -r -i '' "s/(.*pod \'AppsFlyerAdobeAEPExtension)\'(.*\'[0-9]+\.[0-9]+\.[0-9]+\')/\1-qa\',\'$rcVersion\'/g" AdobeAEPSample/Podfile

sed -r -i '' "s/(- iOS AppsFlyer SDK .*)([0-9]+\.[0-9]+\\.[0-9]+)(.*)/\1$appsflyerLibVersion\3/g" README.md

sed -r -i '' "s/(.*EXTENSION_VERSION.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerLibVersion\3/g" AppsFlyerAdobeExtension/Sources/AppsFlyerConstants.swift

touch "releasenotes.$appsflyerLibVersion"
16 changes: 16 additions & 0 deletions .github/bash_scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

releaseVersion=$1

sed -r -i '' "s/version_plugin = \'[0-9]+\.[0-9]+\.[0-9]+.*\'/version_plugin = \'$releaseVersion\'/g" AppsFlyerAdobeAEPExtension-qa.podspec
sed -i '' "s/s.name = \'AppsFlyerAdobeAEPExtension-qa\'/s.name = \'AppsFlyerAdobeAEPExtension\'/g" AppsFlyerAdobeAEPExtension-qa.podspec
mv AppsFlyerAdobeAEPExtension-qa.podspec AppsFlyerAdobeAEPExtension.podspec

sed -r -i '' "s/(.*pod \'AppsFlyerAdobeAEPExtension)-qa\'(.*)/\1\',\'$releaseVersion\'/g" AdobeAEPSample/Podfile

sed -i '' 's/^/* /' "releasenotes.$releaseVersion"
NEW_VERSION_RELEASE_NOTES=$(cat "releasenotes.$releaseVersion")
NEW_VERSION_SECTION="### $releaseVersion\n$NEW_VERSION_RELEASE_NOTES\n\n"
echo -e "$NEW_VERSION_SECTION$(cat RELEASENOTES.md)" > RELEASENOTES.md

rm -r "releasenotes.$releaseVersion"
38 changes: 38 additions & 0 deletions .github/workflows/prepare-for-QA-&-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: pre-release

on:
workflow_call:

jobs:
Change-HardCoded-Version-And-Then-Release:
name: Pre Release
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
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}} ${{env.PLUGIN_VERSION_RC}}
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: Moris Gateno
author_email: [email protected]
message: 'Commited from github action - prepaing the repo for QA locally.'
add: '.'
tag: "${{env.PLUGIN_VERSION_RC}} --force"
tag_push: '--force'
- name: Push to COCOAPODS
run: |
pod trunk me
pod trunk push AppsFlyerAdobeAEPExtension-qa.podspec
34 changes: 34 additions & 0 deletions .github/workflows/prepare-for-release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Prepare plugin for production

on:
pull_request:
types:
- opened
branches:
- 'main'

jobs:
Prepare-Plugin-For-Production:
if: startsWith(github.head_ref, 'releases/')
name: Prepare for production after testing the plugin
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: PR branch check
uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.CI_GITHUB_TOKEN }}
- name: Determine release tag and release branch
run: |
TAG=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
echo "from branch: ${{github.head_ref}}"
echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV
- name: run script
run: bash .github/bash_scripts/release.sh ${{env.PLUGIN_VERSION}}
- name: Commit and Push
run : |
git add .
git commit -m"Commited from github action - prepaing the repo for production."
git push origin HEAD:${{ steps.vars.outputs.branch }} --force
32 changes: 32 additions & 0 deletions .github/workflows/release-QA-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

name: Release plugin to QA

on:
push:
branches:
- releases/[0-9]+.x.x/[0-9]+.[0-9]+.x/[0-9]+.[0-9]+.[0-9]+-rc[0-9]+

jobs:
Check-If-ReleaseNotes-Pushed:
runs-on: ubuntu-latest
outputs:
answer: ${{ steps.filter.outputs.releasenotesfile }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
releasenotesfile:
- 'releasenotes.**'
# Run-Unit-Tests:
# needs: Check-If-ReleaseNotes-Pushed
# if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false'
# uses: ./.github/workflows/unit-tests-workflow.yml

Prepere-To-QA-And-Release:
needs: [Check-If-ReleaseNotes-Pushed]
if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false'
uses: ./.github/workflows/prepare-for-QA-&-release.yml

63 changes: 63 additions & 0 deletions .github/workflows/release-production-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release plugin to production

on:
pull_request:
types:
- closed
branches:
- 'main'
# - 'dev/add-release-workflow'

jobs:
Deploy-To-Production:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/')
runs-on: [ios, self-hosted]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: PR branch check
uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.CI_GITHUB_TOKEN }}
- name: Determine release tag and release branch
run: |
TAG=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
echo "push new release >> $TAG"
echo "from branch: ${{github.head_ref}}"
- name: Create release and tag
env:
TAG: ${{env.PLUGIN_VERSION}}
uses: "actions/github-script@v5"
with:
script: |
try {
await github.rest.repos.createRelease({
draft: false,
generate_release_notes: false,
name: process.env.TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.TAG
});
} catch (error) {
core.setFailed(error.message);
}
- name: Install Cocoapods
run: gem install cocoapods
- name: Push to COCOAPODS
run: |
pod trunk me
pod trunk push AppsFlyerAdobeAEPExtension.podspec
- name: Notify with SLack
uses: slackapi/[email protected]
with:
payload: |
{
"appsflyer_version": "${{env.PLUGIN_VERSION}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
21 changes: 21 additions & 0 deletions .github/workflows/unit-tests-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# name: CI - Tests
# on:
# push:
# branches-ignore:
# - 'master'
# - 'releases/**'
# workflow_call:
# jobs:
# Tests:
# runs-on: macos-12
# steps:
# - uses: actions/checkout@v2
# - uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest-stable
# - name: create Podfile
# run: bash .github/bash_scripts/podfile_creation.sh
# - name: CocoaPod Install
# run: pod install
# - name: Test
# run: xcodebuild test -scheme segment-appsflyer-ios -workspace segment-appsflyer-ios.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty && exit ${PIPESTATUS[0]}
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Static.git", .exact("6.14.3")),
.package(name: "AppsFlyerLib" , url: "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Static.git", .exact("6.14.3")),
.package(url: "https://github.com/adobe/aepsdk-core-ios.git", from: "3.0.0")


Expand Down
Empty file added RELEASENOTES.md
Empty file.

0 comments on commit 8b75a25

Please sign in to comment.