Skip to content

[pre-commit.ci] pre-commit autoupdate (#518) #74

[pre-commit.ci] pre-commit autoupdate (#518)

[pre-commit.ci] pre-commit autoupdate (#518) #74

Workflow file for this run

name: Publish to PyPI
on:
push:
tags:
- "v*.*.*"
jobs:
publish-kr8s:
if: github.repository == 'kr8s-org/kr8s'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/kr8s
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build package
run: pipx install hatch && hatch build
- name: Publish kr8s
uses: pypa/gh-action-pypi-publish@release/v1
publish-kubectl-ng:
if: github.repository == 'kr8s-org/kr8s'
runs-on: ubuntu-latest
needs: publish-kr8s
timeout-minutes: 30
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Update kr8s pin in kubectl-ng
run: |
pushd examples/kubectl-ng
until false; do
poetry add kr8s==${RELEASE_VERSION} && break
echo "Waiting for kr8s==${RELEASE_VERSION} to be available on PyPI..."
sleep 15
done
poetry lock
popd
- name: Push new pins back to the repo
run: |
git config --global user.name 'Kr8s Bot'
git config --global user.email '[email protected]'
git commit -am "Bumping kubectl-ng pin to ${RELEASE_VERSION}"
git push origin HEAD:main
# Move the pin forward in our working copy to ensure the version is
# dynamically generated correctly during publishing
git tag -d ${RELEASE_VERSION} && git tag ${RELEASE_VERSION}
- name: Publish kubectl-ng
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN_KUBECTL_NG }}
poetry_version: ==1.4.0
plugins: "poetry-dynamic-versioning-plugin"
package_directory: "examples/kubectl-ng"