push package only on new tag

This commit is contained in:
makaveli10
2023-10-13 19:11:58 +08:00
parent 0ea554f297
commit 28d4bac210
+16 -11
View File
@@ -4,12 +4,14 @@ on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
publish:
build-and-push-package:
runs-on: ubuntu-latest
steps:
@@ -20,11 +22,11 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
- name: Install Additional Requirements
- name: Install Additional requirements
run: |
sudo apt-get -y install portaudio19-dev wget
shell: bash
@@ -35,13 +37,16 @@ jobs:
- name: Install Server Requirements
run: pip install -r requirements/server.txt
- name: Install Wheel for Build
- name: Install Wheel for build
run: pip install wheel twine
- name: Build and Publish Package to PyPI
- name: Build wheel
run: |
python setup.py sdist bdist_wheel
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Push package on Test PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}