generated from David-Lor/Spotify-Collaborative-Public-Playlists-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (54 loc) · 2.08 KB
/
playlist_chart.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
name: "Export playlist chart"
on:
workflow_dispatch: {}
schedule:
- cron: "45 5 * * 0" # weekly (sunday) at 05:45 UTC
jobs:
playlistChart:
name: "Export Spotify Playlist statistics chart and commit on repository"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
with:
fetch-depth: 1
- name: "Setup Python"
uses: actions/setup-python@master
with:
python-version: "3.8"
architecture: "x64"
- name: "Hash requirements files for cache key"
id: hash_requirements
run: |-
cat spotify_client/requirements.txt >> /tmp/requirements.hash
cat spotify_client/requirements.plotly.txt >> /tmp/requirements.hash
echo "::set-output name=hash::$(printf $(sha256sum /tmp/requirements.hash))"
- name: "Cache Python packages"
uses: actions/cache@v2
with:
key: "python_cache_chart-${{ steps.hash_requirements.outputs.hash }}"
path: |
~/.cache/pip
~/.local/lib/python3.8/site-packages
- name: "Install Python requirements"
run: pip install --user -r spotify_client/requirements.txt -r spotify_client/requirements.plotly.txt
- name: "Export stats"
run: python run_spotify_client.py export_stats
env:
PLAYLIST_STATS_FILE: playlist_stats.ndjson
PLAYLIST_FILE: playlist.tsv
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }}
SPOTIFY_PLAYLIST_ID: ${{ secrets.SPOTIFY_PLAYLIST_ID }}
- name: "Export chart"
run: python run_spotify_client.py export_chart
env:
PLAYLIST_STATS_FILE: playlist_stats.ndjson
PLAYLIST_CHART_FILE: playlist_chart.svg
- name: Git Commit & Push
uses: EndBug/add-and-commit@v7
with:
add: "playlist_stats.ndjson playlist_chart.svg"
message: "Export playlist stats & chart"
push: true