Build and Publish #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+a[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+b[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * SUN" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install hatch | |
run: pipx install hatch | |
- name: Build sdist and wheel | |
run: hatch build --clean | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: dist/ | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
permissions: | |
id-token: write | |
environment: | |
name: publish | |
url: https://pypi.org/p/clean-notebook | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |