docs: update README and pyproject.toml files for development setup an… #4
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
| name: Publish tree-disk-rings to PyPI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_override: | |
| description: 'Override version for tree-disk-rings (leave empty to use pyproject.toml version)' | |
| required: false | |
| type: string | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'tree-disk-rings/pyproject.toml' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| rings-pypi-publish: | |
| name: Build and Publish tree-disk-rings | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3.10 for rings | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install Poetry for rings | |
| run: | | |
| curl -sSL https://install.python-poetry.org | python - -y | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Update Poetry configuration for rings | |
| run: poetry config virtualenvs.create false | |
| working-directory: ./tree-disk-rings | |
| - name: Get current rings version | |
| id: get_rings_version | |
| run: | | |
| if [ -n "${{ inputs.version_override }}" ]; then | |
| echo "CURR_VERSION=${{ inputs.version_override }}" >> $GITHUB_ENV | |
| else | |
| CURR_VERSION=$(grep '^version' tree-disk-rings/pyproject.toml | head -1 | sed 's/version = \"\(.*\)\"/\1/') | |
| echo "CURR_VERSION=${CURR_VERSION}" >> $GITHUB_ENV | |
| fi | |
| - name: Get previous rings version | |
| id: get_prev_rings_version | |
| run: | | |
| git fetch --tags | |
| PREV_VERSION=$(git tag --sort=-v:refname | grep 'rings-v' | head -n 1 | sed 's/rings-v//') | |
| echo "PREV_VERSION=${PREV_VERSION}" >> $GITHUB_ENV | |
| - name: Check if rings version has increased | |
| id: check_rings_version | |
| run: | | |
| if [ "$CURR_VERSION" != "$PREV_VERSION" ]; then | |
| echo "version_changed=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "version_changed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Git tag and GitHub release for rings | |
| if: steps.check_rings_version.outputs.version_changed == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: rings-v${{ env.CURR_VERSION }} | |
| release_name: 'tree-disk-rings v${{ env.CURR_VERSION }}' | |
| draft: false | |
| prerelease: false | |
| - name: Install rings dependencies | |
| if: steps.check_rings_version.outputs.version_changed == 'true' | |
| run: poetry install --no-interaction --no-ansi | |
| working-directory: ./tree-disk-rings | |
| - name: Build rings package | |
| if: steps.check_rings_version.outputs.version_changed == 'true' | |
| run: poetry build | |
| working-directory: ./tree-disk-rings | |
| - name: Publish rings package to PyPI | |
| if: steps.check_rings_version.outputs.version_changed == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: tree-disk-rings/dist |