|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - master |
| 7 | + # TODO: disable when confirmed working |
| 8 | + pull_request: |
| 9 | + types: [opened, reopened, synchronize] |
| 10 | + |
| 11 | +env: |
| 12 | + UV_VERSION: "0.4.26" |
| 13 | + DEFAULT_PYTHON_VERSION: "3.12" |
7 | 14 |
|
8 | 15 | jobs: |
9 | 16 | release: |
10 | 17 | name: Release |
11 | 18 | runs-on: ubuntu-latest |
| 19 | + |
12 | 20 | steps: |
13 | 21 | - name: Check out the repository |
14 | 22 | uses: actions/checkout@v4 |
15 | 23 | with: |
16 | 24 | fetch-depth: 2 |
17 | 25 |
|
18 | | - - name: Set up Python |
19 | | - uses: actions/setup-python@v5 |
| 26 | + - name: Install uv version ${{ env.UV_VERSION }} |
| 27 | + uses: astral-sh/setup-uv@v3 |
20 | 28 | with: |
21 | | - python-version: "3.12" |
| 29 | + version: ${{ env.UV_VERSION }} |
22 | 30 |
|
23 | | - - name: Upgrade pip |
24 | | - run: | |
25 | | - pip install --constraint=.github/workflows/constraints.txt pip |
26 | | - pip --version |
| 31 | + - name: Install python ${{ env.DEFAULT_PYTHON_VERSION }} using uv |
| 32 | + run: uv python install ${{ env.DEFAULT_PYTHON_VERSION }} |
27 | 33 |
|
28 | | - - name: Install Poetry |
29 | | - run: | |
30 | | - pip install --constraint=.github/workflows/constraints.txt poetry |
31 | | - poetry --version |
32 | | -
|
33 | | - - name: Check if there is a parent commit |
34 | | - id: check-parent-commit |
35 | | - run: | |
36 | | - echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" |
| 34 | + - name: Get previous commit SHA |
| 35 | + run: echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_ENV |
37 | 36 |
|
38 | 37 | - name: Detect and tag new version |
39 | 38 | id: check-version |
40 | | - if: steps.check-parent-commit.outputs.sha |
41 | | - uses: salsify/action-detect-and-tag-new-version@v2.0.3 |
| 39 | + if: ${{ env.sha }} |
| 40 | + uses: salsify/action-detect-and-tag-new-version@v2 |
42 | 41 | with: |
43 | | - version-command: | |
44 | | - bash -o pipefail -c "poetry version | awk '{ print \$2 }'" |
| 42 | + version-command: uvx hatch version |
45 | 43 |
|
46 | | - - name: Bump version for developmental release |
| 44 | + - name: Bump version for dev release |
47 | 45 | if: "! steps.check-version.outputs.tag" |
48 | 46 | run: | |
49 | | - poetry version patch && |
50 | | - version=$(poetry version | awk '{ print $2 }') && |
51 | | - poetry version $version.dev.$(date +%s) |
| 47 | + VERSION=$(uvx hatch version) |
| 48 | + uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION.dev.$(date +%s) |
52 | 49 |
|
53 | 50 | - name: Build package |
54 | | - run: | |
55 | | - poetry build --ansi |
| 51 | + run: uv build |
56 | 52 |
|
57 | 53 | - name: Publish package on PyPI |
58 | 54 | if: steps.check-version.outputs.tag |
59 | | - uses: pypa/gh-action-pypi-publish@v1.10.3 |
| 55 | + uses: pypa/gh-action-pypi-publish@v1 |
60 | 56 | with: |
61 | 57 | user: __token__ |
62 | 58 | password: ${{ secrets.PYPI_API_TOKEN }} |
63 | 59 |
|
64 | 60 | - name: Publish package on TestPyPI |
65 | 61 | if: "! steps.check-version.outputs.tag" |
66 | | - uses: pypa/gh-action-pypi-publish@v1.10.3 |
| 62 | + uses: pypa/gh-action-pypi-publish@v1 |
67 | 63 | with: |
68 | 64 | user: __token__ |
69 | 65 | password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
70 | 66 | repository_url: https://test.pypi.org/legacy/ |
71 | 67 |
|
72 | 68 | - name: Publish the release notes |
73 | | - uses: release-drafter/release-drafter@v6.0.0 |
| 69 | + uses: release-drafter/release-drafter@v6 |
74 | 70 | with: |
75 | 71 | publish: ${{ steps.check-version.outputs.tag != '' }} |
76 | 72 | tag: ${{ steps.check-version.outputs.tag }} |
|
0 commit comments