Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Создание workflow для сборки релизов
- Loading branch information
1 parent
94ca33e
commit fb6e673
Showing
1 changed file
with
67 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,67 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
name: Release | ||
|
||
jobs: | ||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
tag_name: ${{ steps.tag_name.outputs.tag }} | ||
steps: | ||
- name: Get tag name | ||
id: tag_name | ||
uses: olegtarasov/get-tag@v2.1 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_API_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ steps.tag_name.outputs.tag }} | ||
body: | | ||
# Draft release (${{ steps.tag_name.outputs.tag }}) | ||
### Changes | ||
draft: true | ||
prerelease: false | ||
|
||
publish-pypi: | ||
name: Publish on PyPI | ||
runs-on: ubuntu-latest | ||
needs: create-release | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: pip install build | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build project | ||
run: python -m build --sdist --wheel --outdir dist/ . | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
- name: Get path to wheel | ||
id: wheel_path | ||
run: | | ||
cd ./dist | ||
echo '::set-output name=path::'$(ls -t *.whl | head -1) | ||
- name: Upload wheel to GitHub | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_API_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ./dist/${{ steps.wheel_path.outputs.path }} | ||
asset_name: ${{ steps.wheel_path.outputs.path }} | ||
asset_content_type: application/x-wheel+zip | ||
|