Skip to content

Commit

Permalink
Add deploy workflow (#80)
Browse files Browse the repository at this point in the history
* automated deployment action
* fix #79
* add deploy workflow for automatic uploads to testpypi (release tag) and pypi (GitHub release)
  (based on @IAlibay 's work for alchemlyb) with minor modifications
  - use alchemtest repo
  - use Python 3.9
* created tokens for PyPi and Test PyPi and added them to the repo environment
  "deploy" as TEST_PYPI_API_TOKEN and PYPI_API_TOKEN

Co-authored-by: Irfan Alibay <[email protected]>
  • Loading branch information
orbeckst and IAlibay authored Oct 18, 2022
1 parent 428952c commit 58f5cc7
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and upload to PyPI

on:
push:
branches:
- master
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:
environment: deploy
if: "github.repository == 'alchemistry/alchemtest'"
name: Build pure Python wheel and tarball
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
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: publish_pypi
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 58f5cc7

Please sign in to comment.