-
Notifications
You must be signed in to change notification settings - Fork 21
48 lines (48 loc) · 1.99 KB
/
update_native_agent_version.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
name: Update Native Agent Version
on:
workflow_dispatch:
inputs:
VERSION_NUMBER:
required: true
type: string
IS_ANDROID_AGENT:
required: true
type: boolean
jobs:
update_agent_version:
name: Update Native Agent version on React Native
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: develop
- name: Update version number
run: |
if ${{ github.event.inputs.IS_ANDROID_AGENT }}
then
sed -i 's/com.newrelic.agent.android:agent-gradle-plugin:.*/com.newrelic.agent.android:agent-gradle-plugin:${{ github.event.inputs.VERSION_NUMBER }}\"/' README.md
jq -r '.sdkVersions.android.newrelic |= "${{ github.event.inputs.VERSION_NUMBER }}"' package.json > package-tmp.json && mv package-tmp.json package.json
else
jq -r '.sdkVersions.ios.newrelic |= "${{ github.event.inputs.VERSION_NUMBER }}"' package.json > package-tmp.json && mv package-tmp.json package.json
fi
- name: Setup GitHub Credentials
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
- name: Push Changes to GitHub
run: |
if ${{ github.event.inputs.IS_ANDROID_AGENT }}
then
AGENT_NAME="Android"
else
AGENT_NAME="iOS"
fi
git checkout -b "update_${AGENT_NAME}_ver_${{ github.event.inputs.VERSION_NUMBER }}"
git add package.json README.md
git commit -m "Update $AGENT_NAME Version to ${{ github.event.inputs.VERSION_NUMBER }}"
git remote -v
git push origin HEAD
gh pr create -B "develop" -H "update_${AGENT_NAME}_ver_${{ github.event.inputs.VERSION_NUMBER }}" --title "Update ${AGENT_NAME} agent to ${{ github.event.inputs.VERSION_NUMBER }}" --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}