Skip to content

Commit

Permalink
Merge pull request #107 from MDAnalysis/release-pipeline
Browse files Browse the repository at this point in the history
Add a deployment pipeline
  • Loading branch information
IAlibay authored Oct 28, 2023
2 parents 94948b3 + ea9c781 commit bf4df12
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build and upload to PyPI

on:
push:
tags:
- "*"
release:
types:
- published

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


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


jobs:
build_wheels:
if: "github.repository == 'MDAnalysis/pytng'"
name: Build wheels
runs-on: ${{ matrix.buildplat[0] }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-22.04, manylinux_x86_64, x86_64]
- [macos-11, macosx_*, x86_64]
- [windows-2019, win_amd64, AMD64]
python: ["cp39", "cp310", "cp311", "cp312"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_BUILD_VERBOSITY: 1

- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
retention-days: 7

build_sdist:
if: "github.repository == 'MDAnalysis/pytng'"
name: build package source distribution
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build sdist
run: pipx run build --sdist

- name: upload artifacts
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'release' && github.event.action == 'published')
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
retention-days: 7

upload_testpypi:
if: |
github.repository == 'MDAnalysis/pytng' &&
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
name: testpypi upload
environment:
name: deploy
url: https://test.pypi.org/p/pytng
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: upload_source_and_wheels
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
skip_existing: true
repository_url: https://test.pypi.org/legacy/

upload_pypi:
if: |
github.repository == 'MDAnalysis/pytng' &&
github.event_name == 'release' && github.event.action == 'published'
name: pypi upload
environment:
name: deploy
url: https://pypi.org/p/pytng
permissions:
id-token: write
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: upload_source_and_wheels
uses: pypa/gh-action-pypi-publish@v1.8.10

0 comments on commit bf4df12

Please sign in to comment.