Skip to content

Commit

Permalink
CD when pushed to
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelJanas committed Nov 12, 2023
1 parent aadd2c2 commit 7b959a2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to PyPI

on:
push:
branches: [ master ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine
- name: Build and publish
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/* --skip-existing --non-interactive -u __token__ -p $PYPI_API_TOKEN
- name: Extract version
id: get_version
run: |
echo "PACKAGE_VERSION=$(grep "version=" setup.py | cut -d"'" -f2)" >> $GITHUB_ENV
- name: Notify Discord
if: success()
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
run: |
curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"A new release v$PACKAGE_VERSION has been uploaded to PyPI: [Check it out!](https://pypi.org/project/fortepyan/)\"}" $DISCORD_WEBHOOK_URL

0 comments on commit 7b959a2

Please sign in to comment.