Extend Kubernetes version support to match cloud support (#489) #71
Workflow file for this run
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
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
publish-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: | |
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 'kr8s-bot@users.noreply.github.com' | |
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/poetry-publish@v1.16 | |
with: | |
pypi_token: ${{ secrets.PYPI_TOKEN_KUBECTL_NG }} | |
poetry_version: ==1.4.0 | |
plugins: "poetry-dynamic-versioning-plugin" | |
package_directory: "examples/kubectl-ng" |