Update python-publish.yml

This commit is contained in:
Aaron Heise 2023-02-12 00:24:14 -06:00 committed by GitHub
parent 36df757091
commit 043e4d08f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,8 +10,10 @@ name: Publish
on: on:
workflow_dispatch: workflow_dispatch:
release: push:
types: [published] # Sequence of patterns matched against refs/tags
tags:
- 'release/v*' # Push events to matching v*, i.e. v1.0, v20.15.10
permissions: permissions:
contents: read contents: read
@ -57,20 +59,52 @@ jobs:
- name: Build package - name: Build package
run: poetry build run: poetry build
- name: Set Versions
- name: Upload a Build Artifact uses: actions/github-script@v4
uses: actions/upload-artifact@v3.1.2 id: set_version
with: with:
# Artifact name script: |
name: "pip package" const tag = context.ref.substring(18)
# A file, directory or wildcard pattern that describes what to upload const no_v = tag.replace('v', '')
path: "dist/*" const dash_index = no_v.lastIndexOf('-')
# The desired behavior if no files are found using the provided path. const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
if-no-files-found: error core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)
# - name: Upload a Build Artifact
# uses: actions/upload-artifact@v3.1.2
# with:
# # Artifact name
# name: "pip package"
# # A file, directory or wildcard pattern that describes what to upload
# path: "dist/*"
# # The desired behavior if no files are found using the provided path.
# if-no-files-found: error
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Artefact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/rnsh-${{ steps.set_version.outputs.no-v }}-py3-none-any.whl
asset_name: rnsh-${{ steps.set_version.outputs.no-v }}-py3-none-any.whl
asset_content_type: application/zip
- name: Publish to PyPI - name: Publish to PyPI
env: run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish