|
1 | 1 | --- |
2 | | -name: Test Release to TestPyPI |
| 2 | +name: Test Release |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | push: |
|
11 | 11 |
|
12 | 12 | jobs: |
13 | 13 | test-release: |
14 | | - name: Build and Publish to TestPyPI |
| 14 | + name: Create GitHub Release |
15 | 15 | runs-on: ubuntu-latest |
16 | 16 |
|
17 | 17 | steps: |
|
29 | 29 | echo "version=$(python ./setup.py --version)" >> $GITHUB_OUTPUT |
30 | 30 | echo "Version detected: $(python ./setup.py --version)" |
31 | 31 |
|
32 | | - # Fetch tags to check if version tag already exists |
33 | 32 | - name: Fetch tags |
34 | 33 | run: git fetch --tags origin |
35 | 34 |
|
|
44 | 43 | echo "should_release=true" >> $GITHUB_OUTPUT |
45 | 44 | fi |
46 | 45 |
|
47 | | - - name: Install build dependencies |
48 | | - if: steps.tagcheck.outputs.should_release == 'true' |
49 | | - run: | |
50 | | - python -m pip install --upgrade pip |
51 | | - pip install build twine |
52 | | -
|
53 | | - - name: Install package dependencies |
54 | | - if: steps.tagcheck.outputs.should_release == 'true' |
55 | | - run: | |
56 | | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
57 | | -
|
58 | | - - name: Build package |
59 | | - if: steps.tagcheck.outputs.should_release == 'true' |
60 | | - run: python -m build |
61 | | - |
62 | | - - name: Check package with twine |
63 | | - if: steps.tagcheck.outputs.should_release == 'true' |
64 | | - run: twine check dist/* |
65 | | - |
66 | | - - name: Publish to TestPyPI |
67 | | - if: steps.tagcheck.outputs.should_release == 'true' |
68 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
69 | | - with: |
70 | | - repository-url: https://test.pypi.org/legacy/ |
71 | | - password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
72 | | - skip-existing: true |
73 | | - |
74 | | - - name: Get wheel filename |
75 | | - if: steps.tagcheck.outputs.should_release == 'true' |
76 | | - id: getwheelfile |
77 | | - run: | |
78 | | - echo "wheelfile=$(find dist -type f -name '*.whl')" >> $GITHUB_OUTPUT |
79 | | - echo "tarfile=$(find dist -type f -name '*.tar.gz')" >> $GITHUB_OUTPUT |
80 | | -
|
81 | 46 | - name: Create GitHub Release |
82 | 47 | if: steps.tagcheck.outputs.should_release == 'true' |
83 | 48 | uses: softprops/action-gh-release@v2 |
|
87 | 52 | draft: false |
88 | 53 | prerelease: true |
89 | 54 | generate_release_notes: true |
90 | | - files: | |
91 | | - ${{ steps.getwheelfile.outputs.wheelfile }} |
92 | | - ${{ steps.getwheelfile.outputs.tarfile }} |
93 | 55 | env: |
94 | 56 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments