diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 5821187..f9a9137 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,16 +1,32 @@ name: Publish to PyPi +permissions: + contents: read + on: push: tags: - "v*" jobs: - lint: - uses: prosegrinder/.github/.github/workflows/poetry-lint.yaml@main + black: + uses: prosegrinder/.github/.github/workflows/poetry-black.yaml@main + + pylint: + uses: prosegrinder/.github/.github/workflows/poetry-pylint.yaml@main + + mypy: + uses: prosegrinder/.github/.github/workflows/poetry-mypy.yaml@main + + bandit: + uses: prosegrinder/.github/.github/workflows/poetry-bandit.yaml@main test: - needs: lint + needs: + - pylint + - black + - mypy + - bandit uses: prosegrinder/.github/.github/workflows/poetry-test.yaml@main publish: diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 64e1980..9128fce 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,5 +1,8 @@ name: Python Poetry CI +permissions: + contents: read + on: pull_request: @@ -8,75 +11,28 @@ concurrency: cancel-in-progress: true jobs: - lint: - uses: prosegrinder/.github/.github/workflows/poetry-lint.yaml@main + black: + uses: prosegrinder/.github/.github/workflows/poetry-black.yaml@main + + pylint: + uses: prosegrinder/.github/.github/workflows/poetry-pylint.yaml@main mypy: - runs-on: ubuntu-latest - steps: - - name: Check Out - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: Setup Python - uses: actions/setup-python@v5 - with: - cache: "poetry" - python-version: "3.x" - - name: Install project - run: poetry install --with dev --no-interaction - - name: MyPy - run: | - poetry run mypy src/**/*.py --config-file pyproject.toml + uses: prosegrinder/.github/.github/workflows/poetry-mypy.yaml@main bandit: - runs-on: ubuntu-latest - steps: - - name: Check Out - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: Setup Python - uses: actions/setup-python@v5 - with: - cache: "poetry" - python-version: "3.x" - - name: Install project - run: poetry install --with dev --no-interaction - - name: Bandit - run: | - poetry run bandit --configfile pyproject.toml --recursive src/**/*.py + uses: prosegrinder/.github/.github/workflows/poetry-bandit.yaml@main test: needs: - - lint + - pylint + - black - mypy - bandit uses: prosegrinder/.github/.github/workflows/poetry-test.yaml@main cz-dry-run: needs: test - name: "Dry run Commitizen bump" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Create bump and changelog - uses: commitizen-tools/commitizen-action@0.24.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - check_consistency: true - dry_run: true + uses: prosegrinder/.github/.github/workflows/poetry-cz-dry-run.yaml@main + secrets: + VERSION_BUMP_TAG_TOKEN: "${{ secrets.VERSION_BUMP_TAG_TOKEN }}" diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index cfc264f..f152409 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -1,5 +1,8 @@ name: Bump Version and Create Release +permissions: + contents: write + on: push: branches: @@ -10,9 +13,32 @@ concurrency: cancel-in-progress: true jobs: + black: + uses: prosegrinder/.github/.github/workflows/poetry-black.yaml@main + + pylint: + uses: prosegrinder/.github/.github/workflows/poetry-pylint.yaml@main + + mypy: + uses: prosegrinder/.github/.github/workflows/poetry-mypy.yaml@main + + bandit: + uses: prosegrinder/.github/.github/workflows/poetry-bandit.yaml@main + + test: + needs: + - pylint + - black + - mypy + - bandit + uses: prosegrinder/.github/.github/workflows/poetry-test.yaml@main + release: - if: "!startsWith(github.event.head_commit.message, 'bump:')" + needs: test + if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }} # Don't run 'bump:' + permissions: + contents: write uses: prosegrinder/.github/.github/workflows/poetry-release.yaml@main secrets: VERSION_BUMP_TAG_TOKEN: "${{ secrets.VERSION_BUMP_TAG_TOKEN }}" diff --git a/pyproject.toml b/pyproject.toml index d3e0e13..c0589c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,6 @@ -[tool.commitizen] -version = "1.1.1" -tag_format = "v$version" -update_changelog_on_bump = true -changelog_incremental = true -bump_message = "bump: $current_version → $new_version" -version_files = [ - "pyproject.toml:version", -] - [project] name = "syllables" -version = "1.1.1" +dynamic = ["version"] description = "A Python package for estimating the number of syllables in a word." license = { text = "GPLv3" } readme = "README.md" @@ -39,6 +29,18 @@ homepage = "https://github.com/prosegrinder/python-syllables" repository = "https://github.com/prosegrinder/python-syllables" "Bug Tracker" = "https://github.com/prosegrinder/python-syllables/issues" +[tool.commitizen] +version = "1.1.1" +tag_format = "v$version" +update_changelog_on_bump = true +changelog_incremental = true +bump_message = "bump: $current_version → $new_version" +version_files = [ + "pyproject.toml:version", +] + +[tool.poetry] +version = "1.1.1" [tool.poetry.group.dev.dependencies] pytest = "^7.2.0"