ci (#4) #31
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 | |
| on: | |
| push: | |
| tags: | |
| # Run when a tag is pushed with a valid semantic version number | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| env: | |
| GENERATED_CODE_FOLDER: etptypes | |
| PYTHON_VERSION: 3.9 | |
| jobs: | |
| build: | |
| name: Building generated code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout repository | |
| uses: actions/checkout@v4 | |
| - 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 self add "poetry-dynamic-versioning[plugin]" | |
| - name: π₯ Install dependencies | |
| run: poetry install --no-interaction --no-root | |
| - name: π οΈ Build the package | |
| run: | | |
| cd ${{ env.GENERATED_CODE_FOLDER }} | |
| rm pyproject.toml | |
| cp ${{ github.workspace }}/pyproject.toml . | |
| cp ${{ github.workspace }}/LICENSE . | |
| cp ${{ github.workspace }}/README.md . | |
| poetry build | |
| - name: π Publish to PyPI | |
| run: | | |
| cd ${{ env.GENERATED_CODE_FOLDER }} | |
| poetry config pypi-token.pypi ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD }} | |
| poetry publish |