Skip to content
Open
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
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@

name: Build CI

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

permissions: {}

jobs:
build-and-test:
Expand All @@ -16,17 +22,18 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.12
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
filter: 'blob:none'
depth: 0
fetch-depth: 0
persist-credentials: false
- name: Install requirements
run: |
sudo apt-get update
Expand Down
45 changes: 33 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,47 @@ on:
release:
types: [published]

permissions: {}

jobs:
upload-pypi:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
filter: 'blob:none'
depth: 0
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Build
run: pipx run build
- name: Check dist metadata
run: pipx run twine check dist/*
- name: Upload build as artifacts
uses: actions/upload-artifact@v5
with:
name: dist
path: dist/*

publish:
if: github.event_name == 'release' && startsWith(github.repository_owner, 'adafruit')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: dist
path: ./dist
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
python setup.py sdist
twine upload dist/*
run: pipx run twine upload dist/*