Skip to content

Commit

Permalink
Merge pull request #128 from PyPSA/build-gh-action
Browse files Browse the repository at this point in the history
integrate powerplants.csv update into CI
  • Loading branch information
lkstrp authored Jun 11, 2024
2 parents f58d5e0 + 5b79144 commit d28290f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
File renamed without changes.
50 changes: 43 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Deploy Package
name: Deploy release

on: [push]
on:
push:
tags:
- v*.*.*

jobs:
build-n-publish:
Expand Down Expand Up @@ -29,9 +32,42 @@ jobs:
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
update-dataset:
name: Update powerplants.csv in repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master

- name: Fetch all history for all tags and branches (necessary for setuptools_scm)
run: git fetch --prune --unshallow

- name: Set up Python
uses: actions/setup-python@v2
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
python-version: 3.9

- name: Install package
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Create dataset
run: |
import powerplantmatching as pm
df = pm.powerplants(update=True)
df.to_csv("powerplants.csv", index_label="id")
shell: python

- name: Commit and push changes
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git checkout master
git pull origin master
git add powerplants.csv
git commit -m '[github-actions.ci] auto update `powerplants.csv`' || exit 0
git push origin master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: [
--ignore-regex, "(`<.+>`_)", # Ignore urls in rst
--ignore-words, .codespell.ignore
]
types_or: [python, rst, markdown]
# files: ^(powerplantmatching|doc|test)/
entry: codespell --ignore-words ignore-spelling-words.txt
3 changes: 1 addition & 2 deletions powerplantmatching/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,7 @@ def UBA(
):
"""
Importer for the UBA Database. Please download the data from
`<https://www.umweltbundesamt.de/dokument/datenbank-kraftwerke-in
-deutschland>`_.
`<https://www.umweltbundesamt.de/dokument/datenbank-kraftwerke-in-deutschland>`_.
Parameters
----------
Expand Down

0 comments on commit d28290f

Please sign in to comment.