Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup automated weekly releases #228

Merged
merged 4 commits into from
May 21, 2024
Merged
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
26 changes: 21 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,46 @@

name: Publish Python distributions to PyPI

on: push
on:
push:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
permissions:
# needed for PyPI trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install build --system
- run: uv pip freeze
- if: ${{ github.event_name != 'push' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
DATE=$(date '+%y.%-m.%-d')
echo $DATE
gh release create $DATE --notes "Automated weekly release"
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
run: python -m build --outdir dist/ .
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
if: ${{ github.event_name != 'push' || startsWith(github.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@release/v1