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

Rework GitHub Actions to correctly and sanely push to PyPi in a controlled manner #456

Merged
merged 7 commits into from
Jun 24, 2024
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: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
96 changes: 68 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
types: [opened, edited, synchronize]

jobs:
lib:
build:
name: Build wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -15,34 +16,51 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install CPython
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
python-version: ${{ matrix.python-version }}

- name: Install Deps
- name: Install deps
run: |
python -m ensurepip
pip install wheel setuptools
pip install -r requirements.txt
pip install -U wheel setuptools pip Cython
pip install '.[speed,sound]'

- name: Build
run: python setup.py sdist bdist_wheel
- name: Build wheels
run: pip wheel -w ./wheelhouse/ '.[speed,sound]'

- uses: actions/upload-artifact@v4
with:
name: artifact-wheels-${{ matrix.python-version }}
path: ./wheelhouse/twitchio*.whl

sdist:
name: Make source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: artifact-source-dist
path: "./**/dist/*.tar.gz"

docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install CPython
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.7

Expand All @@ -62,19 +80,41 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: install black
run: |
python -m ensurepip
pip install black

- name: run linter
run: |
black twitchio --line-length 120 --verbose --check
- name: checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.7

- name: install black
run: |
python -m ensurepip
pip install black

- name: run linter
run: |
black twitchio --line-length 120 --verbose --check

upload_pypi:
if: github.event_name == 'push' && github.ref_type == 'tag'
name: Publish built wheels to Pypi
runs-on: ubuntu-latest
environment: release
needs: [build, sdist]
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4

- name: Copy artifacts to dist/ folder
run: |
find . -name 'artifact-*' -exec unzip '{}' \;
mkdir -p dist/
find . -name '*.tar.gz' -exec mv '{}' dist/ \;
find . -name '*.whl' -exec mv '{}' dist/ \;

- uses: pypa/gh-action-pypi-publish@release/v1
name: Publish to PyPI
16 changes: 0 additions & 16 deletions .github/workflows/edit_version.py

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/get_revision.py

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/publish.yml

This file was deleted.