Skip to content

Merge pull request #6 from ajphilton/copilot/fix-github-pages-publish… #20

Merge pull request #6 from ajphilton/copilot/fix-github-pages-publish…

Merge pull request #6 from ajphilton/copilot/fix-github-pages-publish… #20

Workflow file for this run

name: Publish Python 🐍 distribution 📦
on:
push:
branches:
- main
tags:
- 'v*'
paths-ignore:
- 'pages/**'
- '.github/workflows/pages.yaml'
- 'docs/**'
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install build backend
run: python -m pip install --upgrade pip build
- name: Build wheel and sdist
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish to TestPyPI 🧪
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: testpypi
url: https://test.pypi.org/p/caddy-tui
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/
publish-to-pypi:
name: Publish to PyPI 🚀
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/caddy-tui
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/