1616
1717jobs :
1818 build :
19- name : Building generated code
19+ name : Building and push generated code
2020 runs-on : ubuntu-latest
2121
2222 steps :
23- - uses : actions/checkout@v4
23+ - name : 📥 Checkout repository
24+ uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0 # Fetch the entire history to avoid shallow repository issues
2427
2528 - name : Generate code from avro-to-python-etp
2629 uses : ./.github/actions/generate
@@ -29,66 +32,66 @@ jobs:
2932 dest-folder : ${{ env.GENERATED_CODE_FOLDER }}
3033 etp-file-name : ${{ secrets.ETP_FILE_NAME }}
3134
32- - name : Install dependencies
33- uses : ./.github/ actions/prepare-poetry
35+ - name : 🐍 Set up Python
36+ uses : actions/setup-python@v4
3437 with :
3538 python-version : ${{ env.PYTHON_VERSION }}
36- toml-path : ${{ env.GENERATED_CODE_FOLDER }}
39+
40+ - name : 💾 Cache Poetry dependencies
41+ uses : actions/cache@v3
42+ with :
43+ path : ~/.cache/pypoetry
44+ key : poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
45+ restore-keys : |
46+ poetry-${{ runner.os }}-
47+
48+ - name : 📦 Install poetry
49+ uses : abatilo/actions-poetry@v4
50+ with :
51+ poetry-version : ' 2.1.1'
3752
3853 - name : Python Black
3954 run : |
4055 cd ${{ env.GENERATED_CODE_FOLDER }}
56+ poetry add -D black
4157 poetry run black etptypes
4258
43- - name : Build Etptypes-python
59+ - name : 📦 Install poetry-dynamic-versioning
60+ run : poetry self add "poetry-dynamic-versioning[plugin]"
61+
62+ - name : 📥 Install dependencies
63+ run : poetry install --no-interaction --no-root
64+
65+ - name : Configure Poetry with PyPI repository and token
66+ run : |
67+ poetry config repositories.test-pypi https://test.pypi.org/legacy/
68+ poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}
69+
70+ - name : 🛠️ Build the package
4471 run : |
4572 cd ${{ env.GENERATED_CODE_FOLDER }}
73+ rm -rf dist
4674 rm pyproject.toml
4775 cp ${{ github.workspace }}/pyproject.toml .
4876 cp ${{ github.workspace }}/LICENSE .
4977 cp ${{ github.workspace }}/README.md .
78+ if [ ! -f pyproject.toml ]; then echo "pyproject.toml not found"; exit 1; fi
79+ if [ ! -f LICENSE ]; then echo "LICENSE not found"; exit 1; fi
80+ if [ ! -f README.md ]; then echo "README.md not found"; exit 1; fi
81+ poetry version $(poetry version | awk '{print $2}')
5082 poetry build
5183
52- - name : Archive production artifacts
53- uses : actions/upload-artifact@v4
54- with :
55- name : dist-artifact
56- retention-days : 1
57- path : |
58- ${{ env.GENERATED_CODE_FOLDER }}/dist
59- ${{ env.GENERATED_CODE_FOLDER }}/pyproject.toml
60- ${{ env.GENERATED_CODE_FOLDER }}/LICENSE
61- ${{ env.GENERATED_CODE_FOLDER }}/README.md
62-
63- publish :
64- needs : build
65-
66- name : Publish to PyPI-test
67- runs-on : ubuntu-latest
68-
69- steps :
70- - uses : actions/checkout@v4
71-
72- - name : Set up Python ${{ env.PYTHON_VERSION }}
73- uses : actions/setup-python@v4
74- with :
75- python-version : ${{ env.PYTHON_VERSION }}
76-
77- - name : Get build artifacts
78- uses : actions/download-artifact@v4
79- with :
80- name : dist-artifact
81- path : ${{ env.GENERATED_CODE_FOLDER }}
82-
83- - name : Install dependencies
84- uses : ./.github/actions/prepare-poetry
85- with :
86- python-version : ${{ matrix.python-version }}
87- toml-path : ${{ env.GENERATED_CODE_FOLDER }}
84+ # - name: Debug Publish Step
85+ # run: |
86+ # cd ${{ env.GENERATED_CODE_FOLDER }}
87+ # pwd
88+ # ls dist
89+ # poetry version
90+ # poetry config --list
8891
89- - name : Upload to PyPI TEST
92+ - name : 🚀 Publish to PyPI
9093 run : |
9194 cd ${{ env.GENERATED_CODE_FOLDER }}
92- poetry config repositories.test https://test.pypi.org/legacy/
93- poetry config http-basic.test ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} ${{ secrets.POETRY_TEST_PYPI_TOKEN_PASSWORD}}
94- poetry publish --repository test
95+ # poetry version
96+ # poetry publish --build --repository test-pypi
97+ poetry publish --repository test-pypi
0 commit comments