Skip to content

Merge pull request #564 from microsoftgraph/v1.0/pipelinebuild/132033 #8

Merge pull request #564 from microsoftgraph/v1.0/pipelinebuild/132033

Merge pull request #564 from microsoftgraph/v1.0/pipelinebuild/132033 #8

Workflow file for this run

name: Publish package to PyPI and create release
on:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
permissions:
contents: write
jobs:
build:
uses: ./.github/workflows/build.yml
publish:
name: Publish distribution to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment: pypi_prod
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
release:
name: Create release
runs-on: ubuntu-latest
needs: [publish]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --notes '${{ steps.extract-release-notes.outputs.release_notes }}' --title ${{ github.ref_name }} ${{ github.ref_name }}