CI: update release workflow action (#410)

* Run test for uploading test.pypi.org only for releases/* branch

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: update release workflow

- rename action script
- run on ubuntu 20.04

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Update .github/workflows/publish-to-pypi.yml

Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com>

Co-authored-by: Mozi <29089388+pzhlkj6612@users.noreply.github.com>
This commit is contained in:
Hiroshi Miura
2021-10-17 23:57:23 -07:00
committed by GitHub
parent d5213142a8
commit 6ebbd68106

View File

@@ -1,4 +1,4 @@
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI name: Publish Python 🐍 distributions 📦 to PyPI
on: on:
push: push:
@@ -11,13 +11,13 @@ on:
jobs: jobs:
build-n-publish: build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout 🛎️ - name: Checkout 🛎️
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 20 fetch-depth: 50
- name: Fetch release tag - name: Fetch release tag
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python 3.7🐍 - name: Set up Python 3.7🐍
@@ -30,8 +30,8 @@ jobs:
run: python -m build ./ run: python -m build ./
- name: twine check - name: twine check
run: python -m twine check dist/* run: python -m twine check dist/*
- name: Publish distribution 📦 to Test PyPI - name: Publish distribution 📦 to Test PyPI when releases branch
if: ${{ !startsWith(github.event.ref, 'refs/tags') }} if: ${{ startsWith(github.event.ref, 'refs/heads/releases') }}
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@master
with: with:
password: ${{ secrets.testpypi_password }} password: ${{ secrets.testpypi_password }}