stark-core -> stark-engine #7
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
name: Publish to PyPI and Create Release | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
publish: | |
permissions: | |
id-token: write | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Version bump | |
id: version | |
run: | | |
if [[ "v$(poetry version --short)" == "$(git describe --tags --always --abbrev=0)" ]]; then | |
poetry version patch | |
git add pyproject.toml | |
git config --global user.email "mark@parker-programs.com" | |
git config --global user.name "MarkParker5" | |
git commit -m "Version bump v$(poetry version --short)" | |
git push | |
echo Version bumped to $(poetry version --short) | |
fi | |
echo Using version $(poetry version --short) | |
echo VERSION="v$(poetry version --short)" >> $GITHUB_OUTPUT | |
- name: Build distribution | |
id: build | |
run: | | |
poetry build | |
echo FILE="$(ls dist/*.whl -U | head -1)" >> $GITHUB_OUTPUT | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Create tag | |
uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: ${{ steps.version.outputs.VERSION }} | |
- name: Generate changelog | |
id: changelog | |
run: | | |
changelog=$(git log --pretty=format:"- %s" "${{ steps.version.outputs.VERSION }}..HEAD") | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
with: | |
tag_name: ${{ steps.version.outputs.VERSION }} | |
release_name: Release ${{ steps.version.outputs.VERSION }} | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
- name: Upload .whl file | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.build.outputs.FILE }} | |
asset_name: ${{ steps.build.outputs.FILE }} | |
asset_content_type: application/zip |