-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (131 loc) · 4.63 KB
/
update-sdks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
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: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
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: developers@mparticle.com
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: developers@mparticle.com
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'
});