Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 0 additions & 103 deletions .azure-pipelines/publish.yml

This file was deleted.

77 changes: 77 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish

# Builds pytest-playwright and pytest-playwright-asyncio from a release tag and
# uploads them to PyPI. Uses PyPI trusted publishing: PyPI trusts this workflow
# file in the "pypi" environment, so no PyPI token is stored. Runs when a release
# is published. To publish an existing tag, run it by hand with the tag name.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag to publish, for example v0.10.0"
required: true

permissions:
contents: read

jobs:
build:
name: Build packages
runs-on: ubuntu-latest
env:
TAG: ${{ inputs.tag || github.event.release.tag_name }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: refs/tags/${{ env.TAG }}
# setuptools-scm reads the version from the tag.
fetch-depth: 0
- name: Check the tag
run: |
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Can only publish a release tag (vX.Y.Z), got: $TAG"
exit 1
fi
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install "$(grep '^build==' local-requirements.txt)"
- name: Build the wheels and the sdists
run: |
python -m build --outdir dist pytest-playwright
python -m build --outdir dist pytest-playwright-asyncio
- name: Check the wheels and the sdists
run: |
ls -l dist
version="${TAG#v}"
for name in pytest_playwright pytest_playwright_asyncio; do
test -f "dist/$name-$version-py3-none-any.whl"
test -f "dist/$name-$version.tar.gz"
done
test "$(ls dist | wc -l)" -eq 4
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: packages
path: dist/
if-no-files-found: error

publish:
name: Upload to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/pytest-playwright/
permissions:
# Lets the job get the GitHub OIDC token that PyPI trusted publishing needs.
id-token: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: packages
path: dist/
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
Loading