-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (71 loc) · 2.29 KB
/
pyproject-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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 klippy-bot@haun.guru
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