-
Notifications
You must be signed in to change notification settings - Fork 3
166 lines (151 loc) · 6.37 KB
/
main.yaml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: "main job"
on:
pull_request:
branches:
- main
push:
branches:
- "*"
release:
types: [published]
env:
CIQ_VERSION: 4.2.4
jobs:
install-connect-iq:
name: "Install ConnectIQ"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.x"
- uses: actions/cache@v3
id: ciq
with:
path: /opt/ciq
key: ciq-${{ env.CIQ_VERSION }}-${{ hashFiles('manifest.xml') }}
- uses: actions/cache@v3
id: devices
with:
path: ~/.Garmin/ConnectIQ
key: devices-${{ env.CIQ_VERSION }}-${{ hashFiles('manifest.xml') }}
- run: |
sudo apt update
sudo apt-get install --reinstall unzip wget git ssh tar gzip ca-certificates
cd /opt;
wget -q https://developer.garmin.com/downloads/connect-iq/sdks/connectiq-sdk-lin-4.2.4-2023-04-05-5830cc591.zip -O ciq.zip;
unzip ciq.zip -d ciq;
rm -f ciq.zip;
if: steps.ciq.outputs.cache-hit != 'true'
name: Install ConnectIQ SDK
- run: |
pip install -r cicd/requirements.txt
python cicd/get_garmin_devices_v2.py
if: steps.devices.outputs.cache-hit != 'true'
name: Install ConnectIQ Devices
env:
GARMIN_USERNAME: ${{ secrets.GARMIN_USERNAME }}
GARMIN_PASSWORD: ${{ secrets.GARMIN_PASSWORD }}
PYTHONUNBUFFERED: 1
build-ciq:
name: "Build CIQ"
runs-on: ubuntu-latest
needs: "install-connect-iq"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: "adopt" # See 'Supported distributions' for available options
java-version: "16"
- uses: actions/setup-python@v3
with:
python-version: "3.x"
- uses: actions/cache@v3
id: ciq
with:
path: /opt/ciq
key: ciq-${{ env.CIQ_VERSION }}-${{ hashFiles('manifest.xml') }}
- uses: actions/cache@v3
id: devices
with:
path: ~/.Garmin/ConnectIQ
key: devices-${{ env.CIQ_VERSION }}-${{ hashFiles('manifest.xml') }}
- run: |
sed -i "s/0.0.0/${{ github.event.release.tag_name }}/g" manifest.xml
if [[ "${{ github.event.release.tag_name }}" =~ "beta" ]]; then
sed -i "s/4fa3fd29424b46819c4f4d4229cf8051/66a49cdf-46f8-4a50-8e94-6455da238d5f/g" manifest.xml
echo "app_id=66a49cdf-46f8-4a50-8e94-6455da238d5f" >> $GITHUB_ENV
echo "store_id=f894d586-6e05-40ca-915e-23248d635c7f" >> $GITHUB_ENV
echo "dev_id=a1a36384-b09e-4615-88e5-34dae6bc74b1" >> $GITHUB_ENV
echo "beta_app=true" >> $GITHUB_ENV
else
echo "app_id=4fa3fd2-424b-4681-9c4f-4d4229cf8051" >> $GITHUB_ENV
echo "store_id=8c2fce29-0c7c-41f3-9a8f-5d3093c9cf2f" >> $GITHUB_ENV
echo "dev_id=2ea98679-5efa-457d-bead-a9eedbf7ceab" >> $GITHUB_ENV
echo "beta_app=false" >> $GITHUB_ENV
fi
echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
if: github.event_name == 'release'
name: set the release version
- run: |
echo /opt/ciq/bin >> $GITHUB_PATH
echo "$CIQ_DEV_KEY" | base64 -d > /tmp/dev.key
java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar /opt/ciq/bin/monkeybrains.jar -v
for i in $(grep "product id=" manifest.xml | cut -d \" -f2); do
if [[ "$i" =~ ^(d2mach1|venu2|venu2s|venu2plus|fenix7|fenix7s|fenix7x|fenix7pro|fenix7spro|fenix7xpro|fr955|fr965|epix2|epix2pro42mm|epix2pro47mm|epix2pro51mm|fr265|fr265s|fr255|fr255m|fr255sm|fr255s|marq2|marq2aviator)$ ]]; then
export SDK=4.2.0
elif [[ "$i" =~ ^(d2airx10)$ ]]; then
export SDK=4.0.0
elif [[ "$i" =~ ^(approachs60)$ ]]; then
export SDK=2.4.0
elif [[ "$i" =~ ^(venu|vivoactive4|vivoactive4s|fr245|fr745|fr945|fr945lte|marq)$ ]]; then
export SDK=3.3.0
elif [[ "$i" =~ ^(approachs62|d2charlie|descentmk1|vivoactive3d)$ ]]; then
export SDK=3.0.0
elif [[ "$i" =~ ^(vivoactive3|vivoactive3mlte|fr645|fr935|d2delta|d2deltapx|d2deltas|fenix5|fenix5s|fenix5x)$ ]]; then
export SDK=3.1.0
elif [[ "$i" =~ ^(d2air|fr645m|vivoactive3m|venud)$ ]]; then
export SDK=3.2.0
elif [[ "$i" =~ ^(enduro|fenix6|fenix6pro|fenix6s|fenix6spro|fenix6x|fenix6xpro|fr55|fr945lte|marqadventurer|marqathlete|marqaviator|marqcaptain|marqcommander|marqdriver|marqexpedition|marqgolfer)$ ]]; then
export SDK=3.4.0
else
export SDK=3.3.0
fi
echo "BUILDING $i with sdk $SDK"
java -jar /opt/ciq/bin/monkeybrains.jar -o /tmp/RunPowerWorkout-$i.prg -w -y /tmp/dev.key -d $i -c $SDK -f monkey.jungle -l 0 || true
echo "----------"
done
echo "Building the IQ file"
java -jar /opt/ciq/bin/monkeybrains.jar -o /tmp/RunPowerWorkout.iq -e -w -y /tmp/dev.key -r -f monkey.jungle
name: Build IQ file
env:
CIQ_DEV_KEY: ${{ secrets.CIQ_DEVELOPER_KEY }}
- uses: actions/upload-artifact@v3
with:
name: prg
path: /tmp/*.prg
if: github.event_name != 'release'
- uses: actions/upload-artifact@v3
with:
name: iq
path: /tmp/*.iq
if: github.event_name != 'release'
- name: Upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GARMIN_USERNAME: ${{ secrets.GARMIN_USERNAME }}
GARMIN_PASSWORD: ${{ secrets.GARMIN_PASSWORD }}
APP_ID: ${{ env.app_id }}
TAG_NAME: ${{ env.TAG_NAME }}
STORE_ID: ${{ env.store_id }}
DEV_ID: ${{ env.dev_id }}
BETA_APP: ${{ env.beta_app }}
DEV_EMAIL: ${{ secrets.DEV_EMAIL }}
PYTHONUNBUFFERED: 1
if: github.event_name == 'release'
run: |
for file in /tmp/*.prg; do mv "$file" "${file%.prg}-${TAG_NAME}.prg"; done
mv /tmp/RunPowerWorkout.iq /tmp/RunPowerWorkout-${TAG_NAME}.iq
hub release edit $(find /tmp/ -type f \( -name 'RunPowerWorkout*.prg' -o -name '*.iq' \) -printf "-a %p ") -m "" "$TAG_NAME"
pip install -r cicd/requirements.txt
python cicd/upload_to_garmin.py