Skip to content

Commit

Permalink
save data files to cache
Browse files Browse the repository at this point in the history
  • Loading branch information
agassiyzh committed Jul 18, 2023
1 parent 1128a62 commit cd3bcf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Cache Data Files
uses: actions/cache@v2
with:
path: |
FIT_OUT
GPX_OUT
TCX_OUT
activities
assets
scripts/data.db
key: data-files

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.4
with:
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/run_data_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Set Variables
id: set_variables
run: |
sudo apt-get install libxml2-dev libxslt-dev python3-dev
sudo apt-get install libxml2-dev libxslt-dev python3-dev
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT
Expand All @@ -60,6 +60,19 @@ jobs:
with:
path: ${{ steps.set_variables.outputs.PIP_CACHE }}
key: Ubuntu-pip-${{ steps.set_variables.outputs.PY }}

- name: Cache Data Files
uses: actions/cache@v2
with:
path: |
FIT_OUT
GPX_OUT
TCX_OUT
activities
assets
scripts/data.db
key: data-files

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -144,11 +157,3 @@ jobs:
python scripts/gen_svg.py --from-db --title "${{ env.TITLE_GRID }}" --type grid --athlete "${{ env.ATHLETE }}" --output assets/grid.svg --special-color yellow --special-color2 red --special-distance 20 --special-distance2 40 --use-localtime --min-distance "${{ env.MIN_GRID_DISTANCE }}"
python scripts/gen_svg.py --from-db --type circular --use-localtime
python scripts/gen_svg.py --from-db --year $(date +"%Y") --language zh_CN --title "$(date +"%Y") Running" --type github --athlete "${{ env.ATHLETE }}" --special-distance 10 --special-distance2 20 --special-color yellow --special-color2 red --output assets/github_$(date +"%Y").svg --use-localtime --min-distance 0.5
- name: Push new runs
run: |
git config --local user.email "${{ env.GITHUB_EMAIL }}"
git config --local user.name "${{ env.GITHUB_NAME }}"
git add .
git commit -m 'update new runs' || echo "nothing to commit"
git push || echo "nothing to push"

0 comments on commit cd3bcf9

Please sign in to comment.