-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aadd2c2
commit 7b959a2
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |