Skip to content

chore: release 2.7.10 #42

chore: release 2.7.10

chore: release 2.7.10 #42

Workflow file for this run

name: Publish to PyPI
# Triggered by pushing a version tag (e.g. 2.4.4, 2.5.0).
# Builds sdist + wheel, publishes to PyPI via trusted publishing
# (no API tokens required), and creates a GitHub release with the
# built artifacts attached.
#
# Setup (one-time, on PyPI):
# 1. https://pypi.org/manage/project/instagrapi/settings/publishing/
# 2. Pending publisher:
# Owner: subzeroid
# Repository name: instagrapi
# Workflow name: publish.yml
# Environment name: pypi
# 3. After the first successful run, the publisher is no longer pending.
#
# Release flow:
# 1. Bump version in pyproject.toml
# 2. Commit and push to master
# 3. git tag X.Y.Z && git push origin X.Y.Z
# 4. This workflow builds, publishes to PyPI, and creates a GitHub Release.
#
# Security note: tag-name (github.ref_name) is constrained by the trigger
# regex below to digits/dots only, so it is safe to interpolate. All other
# uses pass it through env: TAG to follow the recommended safe pattern.
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install build
run: python -m pip install --upgrade build
- name: Verify tag matches pyproject.toml version
env:
TAG: ${{ github.ref_name }}
run: |
VERSION=$(grep -E '^version[[:space:]]*=' pyproject.toml | head -1 | sed -E 's/^version[[:space:]]*=[[:space:]]*"([^"]+)".*/\1/')
if [ "$TAG" != "$VERSION" ]; then
echo "::error::Tag $TAG does not match pyproject.toml version $VERSION"
exit 1
fi
- name: Build sdist + wheel
run: python -m build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/instagrapi/${{ github.ref_name }}/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Create GitHub Release
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release create "$TAG" \
"dist/instagrapi-$TAG-py3-none-any.whl" \
"dist/instagrapi-$TAG.tar.gz" \
--title "$TAG" \
--generate-notes