forked from trustwallet/assets
-
Notifications
You must be signed in to change notification settings - Fork 15
91 lines (78 loc) · 2.68 KB
/
coingecko.yml
File metadata and controls
91 lines (78 loc) · 2.68 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: CoinGecko Assets
run-name: "CoinGecko: ${{ inputs.coin_id || (github.event.schedule == '30 */3 * * *' && 'new') || inputs.coin_list || 'trending' }}"
on:
workflow_dispatch:
inputs:
coin_list:
description: 'Coin list type'
required: true
type: choice
options:
- trending
- new
default: trending
coin_id:
description: 'Specific CoinGecko Coin ID (leave empty to use coin_list)'
required: false
schedule:
- cron: '0 */1 * * *' # trending - every hour
- cron: '30 */3 * * *' # new - every 3 hours
concurrency:
group: coingecko
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
download-images:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.commit.outputs.has_changes }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout core repository
uses: actions/checkout@v4
with:
repository: gemwalletcom/core
path: core
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Restore cargo cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
workspaces: "core -> target"
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Download images
working-directory: core
env:
COINGECKO_KEY_SECRET: ${{ secrets.COINGECKO_KEY_SECRET }}
run: |
if [ -n "${{ inputs.coin_id }}" ]; then
cargo run --package img-downloader -- --folder ../blockchains --coin-id ${{ inputs.coin_id }}
elif [ "${{ github.event.schedule }}" = "30 */3 * * *" ] || [ "${{ inputs.coin_list }}" = "new" ]; then
cargo run --package img-downloader -- --folder ../blockchains --coin-list new --delay 10000
else
cargo run --package img-downloader -- --folder ../blockchains --coin-list trending --delay 20000
fi
- name: Generate assets list
run: ./.github/scripts/generate-assets-list.sh
- name: Commit and push
id: commit
run: |
if [ -n "${{ inputs.coin_id }}" ]; then
MSG="Update CoinGecko assets: ${{ inputs.coin_id }}"
elif [ "${{ github.event.schedule }}" = "30 */3 * * *" ] || [ "${{ inputs.coin_list }}" = "new" ]; then
MSG="Update CoinGecko new assets"
else
MSG="Update CoinGecko trending assets"
fi
./.github/scripts/commit-changes.sh "$MSG"
upload-and-purge:
needs: download-images
if: needs.download-images.outputs.has_changes == 'true'
uses: ./.github/workflows/upload.yml
secrets: inherit