Skip to content

Commit

Permalink
Update publish-to-pypi.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bastonero committed Oct 24, 2022
1 parent c9e512e commit b686dc9
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
name: Publish PyPI and TestPyPI
name: Publish on PyPI

on: push
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
build-linux:
publish:
runs-on: ubuntu-latest

strategy:
max-parallel: 5
if: github.repository == 'aiida-phonopy/aiida-phonopy' && startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Make sdist and bdist_wheel
run: pip install .

- name: Publish package to TestPyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/develop')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/develop')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
uses: actions/setup-python@v1
with:
python-version: '3.8'

- name: Install flit
run: |
python -m pip install --upgrade pip
python -m pip install flit~=3.4
- name: Build and publish to TestPyPI
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Build and publish to PyPI
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit b686dc9

Please sign in to comment.