forked from XiaoSiHwang/garmin-sync-coros
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.8 KB
/
garmin-sync-coros.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
name: garmin-sync-coros
on:
workflow_dispatch:
schedule:
- cron: '17,47 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * *'
env:
GITHUB_NAME: MorningGQC
GITHUB_EMAIL: morninggqc@outlook.com
## 佳明配置
GARMIN_AUTH_DOMAIN: ${{ secrets.GARMIN_AUTH_DOMAIN }}
GARMIN_EMAIL: ${{ secrets.GARMIN_EMAIL }}
GARMIN_PASSWORD: ${{ secrets.GARMIN_PASSWORD }}
GARMIN_NEWEST_NUM: ${{ secrets.GARMIN_NEWEST_NUM }}
## Coros配置
COROS_EMAIL: ${{ secrets.COROS_EMAIL }}
COROS_PASSWORD: ${{ secrets.COROS_PASSWORD }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
# from pdm
- name: Set Variables
id: set_variables
run: |
echo "::set-output name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
echo "::set-output name=PIP_CACHE::$(pip cache dir)"
- name: Cache PIP
uses: actions/cache@v2
with:
path: ${{ steps.set_variables.outputs.PIP_CACHE }}
key: Ubuntu-pip-${{ steps.set_variables.outputs.PY }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
if: steps.pip-cache.outputs.cache-hit != 'true'
- name: Run Garmin Sync
run: |
python scripts/garmin/garmin_sync_coros.py
- name: Push new cookie
run: |
git config --local user.email "${{ env.GITHUB_EMAIL }}"
git config --local user.name "${{ env.GITHUB_NAME }}"
git add .
git commit -m 'update garmin activity' || echo "nothing to commit"
git push || echo "nothing to push"