Skip to content

Commit

Permalink
Switch deployment workflow to re-usable action. (#126)
Browse files Browse the repository at this point in the history
* Update deploy.yaml: use the mdanalysis pypi and testpypi deployment actions
  • Loading branch information
IAlibay authored Oct 21, 2023
1 parent 8f06972 commit cb78c4c
Showing 1 changed file with 14 additions and 40 deletions.
54 changes: 14 additions & 40 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and upload to PyPI
name: Build and upload to PyPi

on:
push:
Expand All @@ -8,55 +8,29 @@ on:
types:
- published


concurrency:
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true


defaults:
run:
shell: bash -l {0}


jobs:
build_wheels:
pypi_push:
environment: deploy
if: "github.repository == 'MDAnalysis/GridDataFormats'"
name: Build pure Python wheel
name: Build, upload and test pure Python wheels
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: setup_miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.9
auto-update-conda: true
add-pip-as-python-dependency: true
architecture: x64

- name: install_deps
run: |
python -m pip install build
- name: build
run: |
python -m build --sdist --wheel --outdir dist/

- name: publish_testpypi
# Upload to testpypi on every tag
- name: testpypi_deploy
uses: MDAnalysis/pypi-deployment@main
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
token: ${{ secrets.TEST_PYPI_API_TOKEN }}
test_submission: true
package_name: GridDataFormats
module_name: 'gridData'

- name: publish_pypi
- name: pypi_deploy
uses: MDAnalysis/pypi-deployment@main
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
token: ${{ secrets.PYPI_API_TOKEN }}
package_name: GridDataFormats
module_name: 'gridData'

0 comments on commit cb78c4c

Please sign in to comment.