Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: sleepKIT CI

on: [push]
on:
push:
branches:
- main
pull_request:

env:
PYTHON_VERSION: '3.12'
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: Deploy to GitHub Pages

on:
release:
types:
- created
workflow_call:
inputs:
ref:
description: Git ref (branch, tag, or SHA) to publish from
required: false
type: string
workflow_dispatch:
inputs:
ref:
description: Git ref (branch, tag, or SHA) to publish from
required: false
type: string

permissions:
contents: read
Expand All @@ -28,6 +36,8 @@ jobs:
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish to PyPI

on:
workflow_call:
inputs:
ref:
description: Git ref (branch, tag, or SHA) to publish from
required: false
type: string
workflow_dispatch:
inputs:
ref:
description: Git ref (branch, tag, or SHA) to publish from
required: false
type: string

env:
PACKAGE_NAME: sleepkit
PYTHON_VERSION: '3.12'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install and Build 🔧
run: |
uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish:
runs-on: ubuntu-latest
needs:
- build
environment:
name: pypi
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI 📦
uses: pypa/gh-action-pypi-publish@release/v1
39 changes: 0 additions & 39 deletions .github/workflows/release-please-lock.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/release-please.yaml

This file was deleted.

103 changes: 68 additions & 35 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,84 @@
name: Release to PyPi
name: Release Please

on:
release:
types:
- created
push:
tags:
- "v*"
branches:
- main
pull_request:
types:
- opened
- synchronize
- ready_for_review
- reopened
workflow_dispatch:

env:
PACKAGE_NAME: sleepkit
PYTHON_VERSION: '3.12'

jobs:
build:
release-please:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
permissions:
contents: write
pull-requests: write
issues: write
steps:
- id: release
uses: googleapis/release-please-action@v4
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

update-uv-lock:
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout 🛎️
- name: Checkout release PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install and Build 🔧
enable-cache: true
- name: Regenerate uv.lock
run: uv lock
- name: Commit updated lockfile
if: ${{ !cancelled() }}
run: |
uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
if git diff --quiet -- uv.lock; then
echo "uv.lock already up to date."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add uv.lock
git commit -m "chore: sync uv.lock after version bump"
git push

publish:
runs-on: ubuntu-latest
needs:
- build
environment:
name: pypi
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
publish-pypi:
needs: release-please
if: needs.release-please.outputs.releases_created == 'true' || needs.release-please.outputs.release_created == 'true'
permissions:
contents: read
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI 📦
uses: pypa/gh-action-pypi-publish@release/v1
uses: ./.github/workflows/pypi.yaml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
secrets: inherit

publish-docs:
needs: release-please
if: needs.release-please.outputs.releases_created == 'true' || needs.release-please.outputs.release_created == 'true'
permissions:
contents: read
pages: write
id-token: write
uses: ./.github/workflows/docs.yaml
with:
ref: ${{ needs.release-please.outputs.tag_name }}
secrets: inherit