Workflow file for this run
This file contains hidden or 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
| ## | |
| ## Copyright (c) 2022-2023 Geosiris. | |
| ## SPDX-License-Identifier: Apache-2.0 | |
| ## | |
| name: Build-and-Push-TEST | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| GENERATED_CODE_FOLDER: etptypes | |
| PYTHON_VERSION: 3.9 | |
| jobs: | |
| build: | |
| name: Building and push generated code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues | |
| - name: Generate code from avro-to-python-etp | |
| uses: ./.github/actions/generate | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| dest-folder: ${{ env.GENERATED_CODE_FOLDER }} | |
| etp-file-name: ${{ secrets.ETP_FILE_NAME }} | |
| - name: π Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: πΎ Cache Poetry dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| poetry-${{ runner.os }}- | |
| - name: π¦ Install poetry | |
| uses: abatilo/actions-poetry@v4 | |
| with: | |
| poetry-version: '2.1.1' | |
| - name: Python Black | |
| run: | | |
| cd ${{ env.GENERATED_CODE_FOLDER }} | |
| poetry add -D black | |
| poetry run black etptypes | |
| - name: π¦ Install poetry-dynamic-versioning | |
| run: poetry add -D poetry-dynamic-versioning[plugin] | |
| - name: π₯ Install dependencies | |
| run: poetry install --no-interaction --no-root | |
| - name: Configure Poetry with PyPI repository and token | |
| run: | | |
| poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
| poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }} | |
| - name: π οΈ Build the package | |
| run: | | |
| cd ${{ env.GENERATED_CODE_FOLDER }} | |
| rm -rf dist | |
| rm pyproject.toml | |
| cp ${{ github.workspace }}/pyproject.toml . | |
| cp ${{ github.workspace }}/LICENSE . | |
| cp ${{ github.workspace }}/README.md . | |
| if [ ! -f pyproject.toml ]; then echo "pyproject.toml not found"; exit 1; fi | |
| if [ ! -f LICENSE ]; then echo "LICENSE not found"; exit 1; fi | |
| if [ ! -f README.md ]; then echo "README.md not found"; exit 1; fi | |
| poetry version $(poetry version | awk '{print $2}') | |
| # poetry build | |
| # - name: Debug Publish Step | |
| # run: | | |
| # cd ${{ env.GENERATED_CODE_FOLDER }} | |
| # pwd | |
| # ls dist | |
| # poetry version | |
| # poetry config --list | |
| - name: π Publish to PyPI | |
| run: | | |
| cd ${{ env.GENERATED_CODE_FOLDER }} | |
| # poetry version | |
| poetry publish --repository test-pypi --build |