Skip to content

Commit

Permalink
ci: Release to PyPI from GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Dec 22, 2022
1 parent cad09b9 commit f0ec0fe
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Release new version'

on:
push:
tags:
- 'v*.*.*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
architecture: x64
python-version: '3.10'
- name: Build packages
id: build_package
run: |
pip install flit
flit build
echo ::set-output name=targz::$(basename $(ls dist/*tar.gz))
echo ::set-output name=wheel::$(basename $(ls dist/*whl))
- name: Create release on GitHub
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ''
draft: false
prerelease: false
- name: Upload sdist to GitHub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ steps.build_package.outputs.targz }}
asset_name: ${{ steps.build_package.outputs.targz }}
asset_content_type: application/gzip
- name: Upload wheel to GitHub
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ steps.build_package.outputs.wheel }}
asset_name: ${{ steps.build_package.outputs.wheel }}
asset_content_type: application/zip
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit f0ec0fe

Please sign in to comment.