-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 2.29 KB
/
Copy pathfetch-data.yml
File metadata and controls
72 lines (61 loc) · 2.29 KB
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
name: Update Rates And Icons
on:
workflow_dispatch:
schedule:
- cron: "0 0,8,16 * * *"
env:
OPENEXCHANGERATES_API_KEY: ${{ secrets.OPENEXCHANGERATES_API_KEY }}
jobs:
update-rates-and-icons:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main (for scripts)
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Checkout data branch into subdirectory
uses: actions/checkout@v4
with:
ref: data/currency-icons-and-rates
path: currency-data
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check if OPENEXCHANGERATES_API_KEY secret is set
run: |
if [ -z "${{ secrets.OPENEXCHANGERATES_API_KEY }}" ]; then
echo "OPENEXCHANGERATES_API_KEY is NOT set"
exit 1
else
echo "OPENEXCHANGERATES_API_KEY is set (value is masked)"
fi
- name: Run Android rates and icons update
env:
CI_PROJECT_ROOT: "${{ github.workspace }}/currency-data"
run: python3 scripts/update_crypto_data.py
- name: Push into Git
working-directory: currency-data
run: |-
git config user.email "bot@ark-builders.dev"
git config user.name "ARK Builders Bot"
git add core/data/src/main/assets/fiat-rates.json
git add core/data/src/main/assets/crypto-rates.json
git add core/data/src/main/assets/updatedAt
git add -A cryptoicons/src/main/res/drawable
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "chore(rates,icons): auto-update [skip ci]"
git pull origin data/currency-icons-and-rates --no-edit
git push origin data/currency-icons-and-rates
fi
- name: Sync legacy data branch
working-directory: currency-data
run: |-
# TODO: Remove after the Play Store build using data/currency-icons-and-rates is rolled out and users have updated.
git fetch origin refs/heads/exchange-rates:refs/remotes/origin/exchange-rates
git push --force-with-lease origin HEAD:exchange-rates