context_locals generic to private #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow | |
name: "release" | |
# not on every push. Only then a commit is tagged | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*.*.*' | |
defaults: | |
run: | |
shell: bash | |
env: | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
DEST_FOLDER: dist/ | |
permissions: | |
contents: read # This is required for actions/checkout | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@v4 | |
with: | |
# fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow | |
fetch-depth: 0 | |
# https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1 | |
# echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT | |
- name: Get latest tag | |
id: vars | |
run: | | |
echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- name: Install py39 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
# cache: pip | |
# cache-dependency-path: 'requirements/*.pip' | |
- name: "Install tools" | |
run: | | |
python -m pip install --upgrade -r requirements/kit.pip | |
- name: build | |
env: | |
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | |
run: | | |
echo "python igor.py build_next $RELEASE_VERSION" | |
python igor.py build_next "$RELEASE_VERSION" | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: ${{ env.DEST_FOLDER }} | |
publish-to-pypi: | |
name: >- | |
Publish Python distribution to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/logging-strict | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing and sigstore | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: ${{ env.DEST_FOLDER }} | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
github-release: | |
name: >- | |
Sign the Python distribution with Sigstore | |
and upload them to GitHub Release | |
needs: | |
- publish-to-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: ${{ env.DEST_FOLDER }} | |
- name: Sign the dists with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release create | |
'${{ github.ref_name }}' | |
--repo '${{ github.repository }}' | |
--notes "" | |
- name: Upload artifact signatures to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
# Upload to GitHub Release using the `gh` CLI. | |
# `dist/` contains the built packages, and the | |
# sigstore-produced signatures and certificates. | |
run: >- | |
gh release upload | |
'${{ github.ref_name }}' dist/** | |
--repo '${{ github.repository }}' | |
publish-to-testpypi: | |
name: Publish Python distribution to TestPyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/logging-strict | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: ${{ env.DEST_FOLDER }} | |
- name: Publish distribution to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true |