ops: combine the auto-release/publish workflows

This commit is contained in:
Karim shoair
2025-08-23 22:43:03 +03:00
parent 637580e130
commit f8fbd4b0e0
2 changed files with 25 additions and 37 deletions
-33
View File
@@ -1,33 +0,0 @@
name: Publish Python 🐍 distributions 📦 to PyPI
on:
release:
types: [created,published]
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/scrapling
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Install build
run: python3 -m pip install --upgrade build twine setuptools
- name: Build a binary wheel and a source tarball
run: python3 -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
@@ -1,5 +1,5 @@
name: Create Release
# Creates a GitHub release when a PR is merged to main, using the PR title as the version (must start with 'v') and PR body as release notes.
name: Create Release and Publish to PyPI
# Creates a GitHub release when a PR is merged to main (using PR title as version and body as release notes), then publishes to PyPI.
on:
pull_request:
@@ -8,11 +8,15 @@ on:
- main
jobs:
create-release:
create-release-and-publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/scrapling
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
@@ -50,4 +54,21 @@ jobs:
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Install build
run: python3 -m pip install --upgrade build twine setuptools
- name: Build a binary wheel and a source tarball
run: python3 -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1