Merge pull request #39 from SMTG-UCL/develop #51
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release and publish | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-python@v1 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools setuptools_scm wheel | |
pip install numpy | |
pip install -e . | |
pip install -e .[tests] | |
- name: Test | |
run: | | |
for test in tests/test_*py | |
do if [[ "$test" != *"test_local"* ]] | |
then pytest $test | |
fi | |
done # Ignore local tests file, which tests INCAR and POTCAR file writing but not possible on GitHub Actions | |
pytest --mpl tests/test_shakenbreak.py # test output plots | |
pytest --mpl tests/test_plotting.py # test output plots | |
- name: Build packages | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Generate release tag | |
uses: amitsingh-007/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.TWINE_PASSWORD }} | |
- name: Write release info | |
run: | | |
awk 'BEGIN {p = 0} {a = 0 }; /^v\d*.\d*.\d*./ { p += 1; a = 1}; p + a == 1 { print } ' CHANGELOG.rst | sed -e '1,1d' | sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' > release_info.txt | |
- name: Release | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.release_tag }} | |
release_name: ${{ env.release_tag }} | |
body_path: release_info.txt | |
draft: false | |
prerelease: false |