forked from deriv-com/SmartCharts
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (110 loc) · 5.04 KB
/
publish_deriv_charts_and_update_deriv_app.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
name: Publish @deriv/deriv-charts and update package in deriv-app
on:
workflow_dispatch:
jobs:
build_and_publish_deriv_charts:
runs-on: Ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout SmartCharts
uses: 'binary-com/SmartCharts/.github/actions/checkout@master'
with:
repository: 'binary-com/SmartCharts'
path: SmartCharts
ref: master
- name: Custom flutter-chart
id: flutter_chart
uses: 'binary-com/SmartCharts/.github/actions/checkout@master'
with:
repository: 'regentmarkets/flutter-chart'
path: flutter-chart
# temporary reference to an old branch
ref: fe-changes
token: ${{ secrets.REPO_READ_TOKEN }}
- uses: subosito/flutter-action@62f096cacda5168a3bd7b95793373be14fa4fbaf
with:
flutter-version: '3.10.6'
channel: 'stable'
cache: true
- name: Add SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/github_action_key
chmod 600 ~/.ssh/github_action_key
- name: Build flutter
env:
GIT_SSH_COMMAND: 'ssh -i ~/.ssh/github_action_key'
run: |
cd SmartCharts/chart_app
flutter pub get
flutter build web --web-renderer html --release
- name: Setup node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: 20.x
- name: Setup SmartCharts
run: cd SmartCharts && npm install
- name: Build SmartCharts
run: cd SmartCharts && npm run build
- name: Release SmartCharts
env:
CI: true
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: cd SmartCharts && npx semantic-release
update_chart_version_in_deriv_app:
runs-on: Ubuntu-latest
permissions:
pull-requests: write
needs: [build_and_publish_deriv_charts]
steps:
- name: Checkout deriv-app
uses: 'binary-com/SmartCharts/.github/actions/checkout@master'
with:
repository: 'binary-com/deriv-app'
path: deriv-app
ref: master
- name: Setup Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: 18.x
- name: Install jq
run: sudo apt-get install jq
- name: Get the new chart version
id: check_new_version
run: |
new_version=$(npm show @deriv/deriv-charts version)
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Update core package.json
run: |
cd deriv-app/packages/core
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
- name: Update trader package.json
run: |
cd deriv-app/packages/trader
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
- name: Update bot-web-ui package.json
run: |
cd deriv-app/packages/bot-web-ui
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
- name: Update root package-lock.json
run: |
cd deriv-app
npm i -g lerna@^5.5.1
lerna link
lerna bootstrap --hoist --no-ci --strict
lerna link
- name: Create Pull Request to deriv-app
uses: peter-evans/create-pull-request@76c6f5c20e2111bfee3cd30fae52a25e410f5efc
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
commit-message: 'chore: update @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
title: 'Update deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
body: 'This PR updates @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
branch: 'chore/update-deriv-charts-to-${{ steps.check_new_version.outputs.new_version }}'
base: 'master'
path: 'deriv-app'