Skip to content

Nested beartype validators. #33

Nested beartype validators.

Nested beartype validators. #33

Workflow file for this run

---
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2024 Beartype authors.
# See "LICENSE" for further details.
#
# --------------------( SYNOPSIS )--------------------
# GitHub-specific continuous deployment (CD) configuration, enabling automated
# publication of both source tarballs and binary wheels in various popular
# formats to both GitHub itself and PyPI on each push of a tag to the "master"
# branch of this repository.
#
# --------------------( SEE ALSO )--------------------
# * https://blog.chezo.uno/how-to-release-python-package-from-github-actions-d5a1d8edba6e
# Well-authored blog post strongly inspiring this configuration.
# * https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows
# Official PyPA workflow also inspiring this configuration.
# ....................{ TODO }....................
#FIXME: This workflow, while technically working, now emits this warning:
# Trusted Publishers allows publishing packages to PyPI from automated
# environments like GitHub Actions without needing to use username/password
# combinations or API tokens to authenticate with PyPI. Read more:
# https://docs.pypi.org/trusted-publishers
#
#Seems quite reasonable. Let's dig a bit deeper into this when time permits.
# ....................{ METADATA }....................
# Non-human-readable (i.e., machine-readable) label associated with this
# GitHub Actions workflow.
name: release
# ....................{ TRIGGER }....................
# Confine deployment to only new tags satisfying a release-specific format.
on:
push:
# Sequence of glob expressions matched against "refs/tags" pushed to the
# branches above.
tags:
- 'v*' # Match "v"-prefixed tags (e.g., "v6.9.6").
# ....................{ MAIN }....................
jobs:
# ...................{ GITHUB }...................
# Job publishing a human-readable changelog and codebase tarballs to GitHub
# for this release.
release:
name: "Create tagged release on GitHub"
runs-on: ubuntu-latest
steps:
- name: "Checking out repository..."
uses: 'actions/checkout@v4'
- name: "Publishing GitHub release..."
uses: 'ncipollo/release-action@v1'
with:
name: "beartype ${{ github.ref }}"
body: ${{ github.event.commits[0].message }}
token: ${{ secrets.GITHUB_TOKEN }}
# ...................{ PYPI }...................
# Job publishing both a static distribution (sdist) and binary wheel to PyPI
# for this release.
pypi:
name: "Publish tagged release to PyPI"
runs-on: ubuntu-latest
# Perform this job *ONLY* if the prior job succeeded.
needs: release
steps:
- name: "Checking out repository..."
uses: 'actions/checkout@v4'
- name: "Installing latest stable Python 3.x..."
uses: 'actions/setup-python@v5'
with:
python-version: '3.x'
# See "python_test.yml" for further details.
- name: 'Upgrading packager dependencies...'
run: |
set -xe
python -VV
python -m site
python -m pip --quiet install --upgrade pip setuptools wheel
- name: 'Installing package dependencies...'
run: |
python -m pip --quiet install --upgrade twine
- name: "Creating source tarball and binary wheel..."
run: |
set -xe
python setup.py sdist bdist_wheel
- name: "Publishing PyPI release from tag..."
uses: 'pypa/gh-action-pypi-publish@release/v1'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
#FIXME: Enable after integrating this "pypi" job into the "release" job
#above. In theory, this should be trivial. Let's test this later, eh?
# - name: "Publishing GitHub release assets from tag..."
# uses: actions/upload-release-asset@v1.0.1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: "dist/beartype-${{ github.ref }}.zip"
# asset_name: "beartype-${{ github.ref }}.zip"
# asset_content_type: application/zip