Skip to content

Publish the package to pypi #27

Publish the package to pypi

Publish the package to pypi #27

Workflow file for this run

name: Publish the package to pypi
on: workflow_dispatch
jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/lazy-github
permissions:
id-token: write
steps:
# Perform a bunch of setup
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: yezz123/setup-uv@v4
- name: Calculate version
id: calculate-version
run: |
new_version=$((uvx hatch version))
echo "version=${new_version}" >> $GITHUB_OUTPUT
# Build the distribution
- name: Build lazy-github distribution
run: uvx hatch build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Create tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ steps.calculate-version.outputs.version }}',
sha: context.sha
})
- name: Notify when this workflow completes (regardless of success or failure)
needs:

Check failure on line 45 in .github/workflows/publish.yaml

View workflow run for this annotation

GitHub Actions / Publish the package to pypi

Invalid workflow file

The workflow is not valid. .github/workflows/publish.yaml (Line: 45, Col: 7): Unexpected value 'needs' .github/workflows/publish.yaml (Line: 47, Col: 7): Unexpected value 'runs-on'
- pypi-publish
runs-on: ubuntu-latest
uses: nobrayner/discord-webhook@v1
with:
title: "Version ${{ steps.calculate-version.outputs.version }} published to PyPi"
description: "Check out the new version [here](https://pypi.org/project/lazy-github/${{ steps.calculate-version.outputs.version }}/)"
github-token: ${{ secrets.github_token }}
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}