Autogenerated - Upstream 151cf28 #145
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python package | |
on: | |
push: | |
branches: [ "main" ] | |
workflow_dispatch: | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
RELEASE_NAME: klipper-${{ steps.version_number.outputs.KLIPPY_VERSION }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version number | |
id: version_number | |
run: | | |
tee <<<"KLIPPY_VERSION=$(cat klippy/.version)" -a "$GITHUB_OUTPUT" | |
- name: Create tag+release if not yet present | |
env: | |
KLIPPY_VERSION: ${{ steps.version_number.outputs.KLIPPY_VERSION }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
git config user.name Klippy-Tools-Bot | |
git config user.email [email protected] | |
git tag --force -am "Kilpper at $KLIPPY_VERSION" klipper-$KLIPPY_VERSION | |
git push -f origin klipper-$KLIPPY_VERSION | |
if ! gh release view "klipper-$KLIPPY_VERSION" >/dev/null; then | |
gh release create "klipper-$KLIPPY_VERSION" | |
fi | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
upload: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- create_release | |
- build | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: sdist | |
path: dist/ | |
- name: upload to release | |
env: | |
RELEASE_NAME: ${{ needs.create_release.outputs.RELEASE_NAME }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload -R Laikulo/klippy "$RELEASE_NAME" dist/*.tar.gz --clobber | |