Skip to content

Commit

Permalink
Merge pull request #91 from AppsFlyerSDK/releases/6.x.x/6.10.x/6.10.3…
Browse files Browse the repository at this point in the history
…-rc1

Releases/6.x.x/6.10.x/6.10.3 rc1
  • Loading branch information
pazlavi authored May 1, 2023
2 parents 71b1cae + 0202e2a commit d7aa149
Show file tree
Hide file tree
Showing 19 changed files with 1,044 additions and 587 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build-apps-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build apps with AppsFlyer plugin

on:
workflow_call:

jobs:
Build-Capacitor-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x


- name: Install plugin dependencies
run: npm install
- name: Build plugin
run: npm run build
- name: install capacitor-appsflyer on an Android app
run: |
cd examples/CapacitorReact
npm install ../../
npx cap add android
npm run build
npx cap sync android
- name: Build apk
run: |
cd examples/CapacitorReact/android
echo "pwd: $(pwd)"
gradle wrapper
echo "ls: $(ls)"
chmod +x ./gradlew
./gradlew wrapper --gradle-version 7.6.1
./gradlew clean assembleRelease
# Build-Capacitor-ios:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - name: install react-native-appsflyer on an iOS app
# run: |
# cd demos/appsflyer-react-native-app
# yarn install --force
# yarn add ../../ --save
# - name: Install Dependencies
# run: |
# cd demos/appsflyer-react-native-app/ios
# pod install --repo-update

# - name: Setup provisioning profile
# env:
# IOS_KEYS: ${{ secrets.IOS_KEYS }}
# run: |
# chmod +x .github/workflows/scripts/decryptSecrets.sh
# ./.github/workflows/scripts/decryptSecrets.sh
# - name: Archive app
# run: |
# sudo xcode-select --switch /Applications/Xcode_12.5.1.app
# chmod +x .github/workflows/scripts/archiveApp.sh
# cd demos/appsflyer-react-native-app/ios
# ./../../../.github/workflows/scripts/archiveApp.sh
19 changes: 19 additions & 0 deletions .github/workflows/close-inactive-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# This workflow close issue and add comment after the issue labaled as 'inactive'

name: Close issue
on:
issues:
types:
- labeled
jobs:
close-inactive-issue:
if: github.event.label.name == 'Inactive'
runs-on: ubuntu-latest
steps:
- name: Close issue due to inactivity
uses: peter-evans/close-issue@v2
with:
issue-number: ${{ github.event.issue.number }}
comment: |
This issue is closed due to inactivity. If the issue continue, please open a new one.
31 changes: 20 additions & 11 deletions .github/workflows/create-release-branch-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ on:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
BuildNumber:
description: 'Version number (5500)'
required: true
iosVersion:
description: 'iOS SDK version number (5.5.0)'
required: true
AndroidVersion:
description: 'Android SDK version number (5.5.0)'
required: true
DeployToQA:
required: false
description: 'Deploy to QA (open PR and publish RC)'
type: boolean
default: false


jobs:
createRelease:
Expand All @@ -29,20 +32,26 @@ jobs:
git config --global user.name $COMMIT_AUTHOR
git config --global user.email $COMMIT_EMAIL
- name: Create New Branch
id: createBranch
run: |
major=$(echo ${{ github.event.inputs.versionName }}| cut -d'.' -f 1)
minor=$(echo ${{ github.event.inputs.versionName }}| cut -d'.' -f 2)
patch=$(echo ${{ github.event.inputs.versionName }}| cut -d'.' -f 3)
branchName=$(printf "Release/%s.x.x/%s.%s.x/%s.%s.%s" $major $major $minor $major $minor $patch)
major=$(echo ${{ inputs.versionName }}| cut -d'.' -f 1)
minor=$(echo ${{ inputs.versionName }}| cut -d'.' -f 2)
patch=$(echo ${{ inputs.versionName }}| cut -d'.' -f 3)
branchName=$(printf "releases/%s.x.x/%s.%s.x/%s.%s.%s" $major $major $minor $major $minor $patch)
export branchName
echo "BRANCH_NAME=$branchName" >> $GITHUB_ENV
git checkout -b $branchName
- name: Update Codebase
run: |
.github/workflows/scripts/updatePlugin.sh pluginVersion=${{ github.event.inputs.versionName }} buildNumber=${{ github.event.inputs.BuildNumber }} iOSVersion=${{ github.event.inputs.iosVersion }} androidVersion=${{ github.event.inputs.AndroidVersion }}
.github/workflows/scripts/updatePlugin.sh pluginVersion=${{ inputs.versionName }} buildNumber=${{ github.run_number }} iOSVersion=${{ inputs.iosVersion }} androidVersion=${{ inputs.AndroidVersion }}
git commit -m "update versions using CI"
git push
git push -u origin --all
- name: create pull request
if: ${{ inputs.DeployToQA }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr create -B main --title 'Merge $branchName into main' --body 'Created by Github action'
GITHUB_TOKEN: ${{ secrets.CI_DEV_GITHUB_TOKEN }}
run: |
gh pr create -B main --title "Merge ${{ env.BRANCH_NAME }} into main" --body 'Created by Github action'
72 changes: 72 additions & 0 deletions .github/workflows/deploy-to-QA.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Deploy To QA

on:
workflow_call:

jobs:
Deploy-to-QA:
runs-on: ubuntu-latest
environment: Staging
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependency
run: |
npm i rimraf
- name: Login to Github
env:
COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }}
COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }}
run: |
git config --global user.name $COMMIT_AUTHOR
git config --global user.email $COMMIT_EMAIL
- uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Export branch name
run: |
echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
- name: Check if fixed version is on Jira
env:
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

run: |
fixed_version_found=false
plugin_version=$(echo "$BRANCH_NAME" | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
jira_fixed_version="Capacitor SDK v$plugin_version"
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV
echo "JIRA_FIXED_VERSION=$jira_fixed_version" >> $GITHUB_ENV
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$jira_fixed_version"
- name: Build Plugin
run: |
npm run build
- name: Push to NPM
env:
CI_NPM_TOKEN: ${{ secrets.CI_NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$CI_NPM_TOKEN" > ~/.npmrc
npm publish --tag QA
- name: Generate and send slack report
env:
SLACK_TOKEN: ${{ secrets.CI_SLACK_TOKEN }}
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }}
JIRA_FIXED_VERSION: "Capacitor SDK v${{env.PLUGIN_VERSION}}"
RELEASE_BRANCH_NAME: ${{env.RELEASE_BRANCH_NAME}}
run: |
ANDROID_SDK_VERSION=`cat package.json | jq .androidSdkVersion`
IOS_SDK_VERSION=`cat package.json | jq .iosSdkVersion`
PLUGIN_VERSION=`cat package.json | jq .version`
BUILD_NUMBER=`cat package.json | jq .buildNumber`
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"${{env.JIRA_FIXED_VERSION}}"'", "deploy_type": "QA", "install_tag": "QA", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
70 changes: 70 additions & 0 deletions .github/workflows/pre-release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Prepare plugin for production

on:
pull_request:
types: [ labeled ]

jobs:
Prepare-Plugin-For-Production:
if: startsWith(github.head_ref, 'releases/') && github.event.label.name == 'Ready For Production'

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Github
env:
COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }}
COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }}
run: |
git config --global user.name $COMMIT_AUTHOR
git config --global user.email $COMMIT_EMAIL
- uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Update package.json file
run: |
plugin_version=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
# we export plugin_version and release branch name as env so we can use them in the next step
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV
echo "GIT_BRANCH_RELEASE=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
echo "Updating plugin to version $plugin_version"
chmod +x .github/workflows/scripts/updatePluginVersion.sh
chmod +x .github/workflows/scripts/updateBuildNumber.sh
.github/workflows/scripts/updatePluginVersion.sh $plugin_version
.github/workflows/scripts/updateBuildNumber.sh ${{github.run_number}}
git commit -m "Update Plugin Version"
git push origin HEAD:${{ steps.vars.outputs.branch }} --force
- name: Update CHANGELOG.md
env:
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }}
JIRA_FIXED_VERSION: "Capacitor SDK v${{env.PLUGIN_VERSION}}"
run: |
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
NEW_VERSION_RELEASE_NOTES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
NEW_VERSION_SECTION="## ${{ env.PLUGIN_VERSION }}\n Release date: *$(date +%F)*\n\n$NEW_VERSION_RELEASE_NOTES\n"
echo -e "$NEW_VERSION_SECTION\n$(cat CHANGELOG.md)" > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md"
git push origin HEAD:${{ env.GIT_BRANCH_RELEASE }} --force
Approve-Pull-Request:
needs: [ Prepare-Plugin-For-Production ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Export branch name
run: |
echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV
- name: approve pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: | # approve the pull request of the current branch
gh pr review "$PR_NUMBER" --approve
99 changes: 99 additions & 0 deletions .github/workflows/release-Production-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Release plugin to production

on:
pull_request:
types:
- closed
branches:
- 'main'
paths-ignore:
- '**.md'
- '**.yml'
- 'examples/**'
- 'docs/**'
- 'assets/**'
jobs:
# Pre-Release-To-Prod:
# if: github.event.pull_request.merged == true
# uses: ./.github/workflows/pre-release-workflow.yml
# secrets: inherit

Build-Sample-Apps:
# needs: [ Pre-Release-To-Prod ]
uses: ./.github/workflows/build-apps-workflow.yml
secrets: inherit

Deploy-To-Production:
needs: [ Build-Sample-Apps ]
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependency
run: |
npm i rimraf
- name: Login to Github
env:
COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }}
COMMIT_EMAIL: ${{ secrets.CI_COMMIT_EMAIL }}
run: |
git config --global user.name $COMMIT_AUTHOR
git config --global user.email $COMMIT_EMAIL
- uses: mdecoleman/[email protected]
id: vars
with:
repo-token: ${{ secrets.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"
- name: "Create release"
env:
TAG: ${{env.PLUGIN_VERSION}}
uses: "actions/github-script@v5"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
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: Push to NPM
env:
CI_NPM_TOKEN: ${{ secrets.CI_NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$CI_NPM_TOKEN" > ~/.npmrc
npm run build
npm publish
- name: Generate and send slack report
env:
SLACK_TOKEN: ${{ secrets.CI_SLACK_TOKEN }}
JIRA_TOKEN: ${{ secrets.CI_JIRA_TOKEN }}
JIRA_FIXED_VERSION: "Capacitor SDK v${{env.PLUGIN_VERSION}}"
run: |
ANDROID_SDK_VERSION=`cat package.json | jq .androidSdkVersion`
IOS_SDK_VERSION=`cat package.json | jq .iosSdkVersion`
PLUGIN_VERSION=`cat package.json | jq .version`
BUILD_NUMBER=`cat package.json | jq .buildNumber`
chmod +x .github/workflows/scripts/releaseNotesGenerator.sh
.github/workflows/scripts/releaseNotesGenerator.sh $JIRA_TOKEN "$JIRA_FIXED_VERSION"
CHANGES=$(cat "$JIRA_FIXED_VERSION-releasenotes".txt)
curl -X POST -H 'Content-type: application/json' --data '{"jira_fixed_version": "'"${{env.JIRA_FIXED_VERSION}}"'", "deploy_type": "Production", "install_tag": "latest", "git_branch": "'"$RELEASE_BRANCH_NAME"'", "changes_and_fixes": "'"$CHANGES"'", "plugin_version": "'"${{env.PLUGIN_VERSION}}"'", "android_dependency": "'"$ANDROID_SDK_VERSION"'", "ios_dependency": "'"$IOS_SDK_VERSION"'"}' "$SLACK_TOKEN"
Loading

0 comments on commit d7aa149

Please sign in to comment.