Update SDKs #206
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update SDKs" | |
on: | |
schedule: | |
- cron: '00 15 * * 1' | |
workflow_dispatch: | |
jobs: | |
update-android-sdk: | |
name: "Update Android SDK" | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: mparticle-automation | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: mparticle-automation | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: "Download Android Maven Metadata" | |
run: curl https://repo1.maven.org/maven2/com/mparticle/android-core/maven-metadata.xml -o maven-metadata.xml | |
- name: "Parse Latest Version" | |
id: latest-version | |
uses: QwerMike/xpath-action@v1 | |
with: | |
filename: 'maven-metadata.xml' | |
expression: '//versioning/latest/text()' | |
- name: "Checkout" | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
fetch-depth: 0 | |
lfs: true | |
- name: "Import GPG Key" | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: "Download Maven Artifact" | |
id: download-maven-artifact | |
uses: clausnz/github-action-download-maven-artifact@master | |
with: | |
url: 'https://repo1.maven.org' | |
repository: 'maven2' | |
groupId: 'com.mparticle' | |
artifactId: 'android-core' | |
version: '5.36.2' #${{steps.latest-version.outputs.result}} | |
extension: 'aar' | |
- name: "Output file path in container" | |
run: | | |
jar xf ${{steps.download-maven-artifact.outputs.file}} classes.jar | |
mv -f classes.jar Assets/Plugins/Android/mparticle-core.jar | |
- name: "Commit Changes" | |
run: | | |
git add Assets/Plugins/Android | |
git diff-index --quiet HEAD || git commit -m "update: mParticle Android SDK to version 5.36.2"; | |
git push -f origin HEAD:chore/update-sdks | |
update-apple-sdk: | |
name: "Update iOS SDK" | |
needs: update-android-sdk | |
runs-on: macos-latest | |
env: | |
GIT_AUTHOR_NAME: mparticle-automation | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: mparticle-automation | |
GIT_COMMITTER_EMAIL: [email protected] | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v2 | |
with: | |
ref: chore/update-sdks | |
fetch-depth: 0 | |
lfs: true | |
- name: "Import GPG Key" | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: "Create Cartfile" | |
run: echo "github \"mparticle/mparticle-apple-sdk\"" > Cartfile | |
- name: "Carthage Install" | |
run: carthage update | |
- name: "Move mParticle-apple-sdk.framework" | |
run: | | |
rm -rf Assets/Plugins/iOS/mParticle_Apple_SDK.framework; | |
mv -f carthage/Build/iOS/mParticle_Apple_SDK.framework Assets/Plugins/iOS/ | |
- name: "Commit Changes" | |
run: | | |
git add Assets/Plugins/iOS | |
git diff-index --quiet HEAD || git commit -m "update: mParticle Apple SDK to version $(cut -d'"' -f2 <<< `carthage checkout`)"; git push origin HEAD:chore/update-sdks | |
open-pr: | |
name: "Open Update SDKs PR" | |
needs: update-apple-sdk | |
runs-on: ubuntu-latest | |
env: | |
GIT_AUTHOR_NAME: mparticle-automation | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: mparticle-automation | |
GIT_COMMITTER_EMAIL: [email protected] | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v2 | |
with: | |
ref: chore/update-sdks | |
fetch-depth: 0 | |
lfs: true | |
- name: "Check For Changes" | |
id: check-changes | |
run: | | |
if [ `git rev-parse HEAD` = `git rev-parse origin/main` ]; | |
then | |
OUTPUT=false; | |
else | |
OUTPUT=true; | |
fi; | |
echo "::set-output name=hasChanges::$OUTPUT" | |
echo "has changes: $OUTPUT" | |
- name: "Open PR" | |
if: ${{steps.check-changes.outputs.hasChanges == 'true'}} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.pulls.create({ | |
title: 'chore: update sdk artifacts', | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head: 'chore/update-sdks', | |
base: 'main' | |
}); |