download.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: download
  2. on:
  3. schedule:
  4. - cron: "37 4 7 * *" # monthly on the seventh day of the month at 04:37
  5. workflow_dispatch: # if run manually
  6. jobs:
  7. download:
  8. runs-on: ubuntu-22.04
  9. steps:
  10. - name: set download date
  11. run: echo "DOWNLOAD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
  12. - name: install datalad
  13. uses: awalsh128/cache-apt-pkgs-action@v1.4.2
  14. with:
  15. packages: datalad
  16. version: 1.0
  17. - name: install ssh key for gin.hemio.de access
  18. uses: shimataro/ssh-key-action@v2
  19. with:
  20. key: ${{ secrets.GIN_HEMIO_SSH_KEY }}
  21. name: id_ginhemio
  22. known_hosts: |
  23. gin.hemio.de ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPA+r/S2vn2JmN9z62e/vla/pDgaEfFUmghlOP7idyP9
  24. config: |
  25. Host gin.hemio.de
  26. User git
  27. IdentityFile ~/.ssh/id_ginhemio
  28. IdentitiesOnly yes
  29. - name: configure git user
  30. run: git config --global user.email "mika.pflueger@climate-resource.com"
  31. - name: configure git email
  32. run: git config --global user.name "Mika Pflüger (via github actions)"
  33. - name: clone repo
  34. run: datalad clone https://github.com/mikapfl/unfccc_di_data.git
  35. - name: configure push access to gin.hemio.de
  36. run: |
  37. cd unfccc_di_data/
  38. datalad siblings add -s ginhemio --url https://gin.hemio.de/CR/unfcc_di_data --pushurl gin.hemio.de:/CR/unfcc_di_data
  39. git config remote.ginhemio.annex-ignore false
  40. - name: setup Python
  41. uses: actions/setup-python@v5
  42. with:
  43. python-version: '3.11'
  44. - name: install requirements
  45. run: pip install -r unfccc_di_data/requirements.txt
  46. - name: update to latest data from gin.hemio.de
  47. run: datalad -C unfccc_di_data/ update -s ginhemio --how merge
  48. - name: download data
  49. run: datalad -C unfccc_di_data/ run -o data/annexI/*.csv.gz -o data/non-annexI/*.csv.gz -o data/all.parquet python download.py
  50. - name: publish newly downloaded data
  51. run: |
  52. cd unfccc_di_data/
  53. datalad update -s ginhemio --how merge
  54. datalad push --to ginhemio --data anything