diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 55a58d4..e66d951 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,42 @@ on: branches: - master workflow_dispatch: + inputs: + release_force: + # see https://python-semantic-release.readthedocs.io/en/latest/github-action.html#command-line-options + description: | + Force release be one of: [major | minor | patch] + Leave empty for auto-detect based on commit messages. + type: choice + options: + - "" # auto - no force + - major # force major + - minor # force minor + - patch # force patch + default: "" + required: false + prerelease_token: + description: 'The "pre-release identifier" to use as a prefix for the "pre-release" part of a semver. Like the rc in `1.2.0-rc.8`.' + type: choice + options: + - rc + - beta + - alpha + default: rc + required: false + prerelease: + description: "Is a pre-release" + type: boolean + default: false + required: false + +concurrency: + group: deploy + cancel-in-progress: false # prevent duplicates semantic-release + +env: + PYTHON_VERSION_DEFAULT: "3.9" + POETRY_VERSION: "1.4.2" jobs: build-and-release: @@ -15,22 +51,49 @@ jobs: concurrency: release steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - name: Setup Python Environment + # see https://github.com/actions/setup-python + uses: actions/setup-python@v5 with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install poetry --upgrade pip - poetry config virtualenvs.create false - poetry install + python-version: ${{ env.PYTHON_VERSION_DEFAULT }} + architecture: 'x64' + - name: Install poetry + # see https://github.com/marketplace/actions/setup-poetry + uses: Gr1N/setup-poetry@v9 + with: + poetry-version: ${{ env.POETRY_VERSION }} - name: View poetry version run: poetry --version + - name: Install dependencies + run: | +# poetry config virtualenvs.create false + poetry install --no-root + - name: Python Semantic Release - uses: relekang/python-semantic-release@master + id: release + # see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html + # see https://github.com/python-semantic-release/python-semantic-release + uses: python-semantic-release/python-semantic-release@v9.1.1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - pypi_token: ${{ secrets.PYPI_TOKEN }} + force: ${{ github.event.inputs.release_force }} + prerelease: ${{ github.event.inputs.prerelease }} + prerelease_token: ${{ github.event.inputs.prerelease_token }} + + - name: Publish package distributions to PyPI + if: steps.release.outputs.released == 'true' + # see https://github.com/pypa/gh-action-pypi-publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TOKEN }} + - name: Publish package distributions to GitHub Releases + if: steps.release.outputs.released == 'true' + # see https://github.com/python-semantic-release/upload-to-gh-release + uses: python-semantic-release/upload-to-gh-release@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.release.outputs.tag }} diff --git a/.github/workflows/poetry.yml b/.github/workflows/poetry.yml index d38fbc1..50a9ec7 100644 --- a/.github/workflows/poetry.yml +++ b/.github/workflows/poetry.yml @@ -14,8 +14,8 @@ on: env: REPORTS_DIR: CI_reports - PYTHON_VERISON_DEFAULT: "3.10" - POETRY_VERSION: "1.1.11" + PYTHON_VERSION_DEFAULT: "3.10" + POETRY_VERSION: "1.4.2" jobs: coding-standards: @@ -24,16 +24,16 @@ jobs: steps: - name: Checkout # see https://github.com/actions/checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python Environment # see https://github.com/actions/setup-python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: ${{ env.PYTHON_VERISON_DEFAULT }} + python-version: ${{ env.PYTHON_VERSION_DEFAULT }} architecture: 'x64' - name: Install poetry # see https://github.com/marketplace/actions/setup-poetry - uses: Gr1N/setup-poetry@v7 + uses: Gr1N/setup-poetry@v9 with: poetry-version: ${{ env.POETRY_VERSION }} - name: Install dependencies @@ -57,16 +57,16 @@ jobs: steps: - name: Checkout # see https://github.com/actions/checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python Environment # see https://github.com/actions/setup-python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: 'x64' - name: Install poetry # see https://github.com/marketplace/actions/setup-poetry - uses: Gr1N/setup-poetry@v7 + uses: Gr1N/setup-poetry@v9 with: poetry-version: ${{ env.POETRY_VERSION }} - name: Install dependencies @@ -95,7 +95,7 @@ jobs: os: 'ubuntu-latest' python-version: '3.6' toxenv: 'lowest' - timeout-minutes: 30 + timeout-minutes: 15 steps: - name: Disabled Git auto EOL CRLF transforms run: | @@ -103,12 +103,12 @@ jobs: git config --global core.eol lf - name: Checkout # see https://github.com/actions/checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Create reports directory run: mkdir ${{ env.REPORTS_DIR }} - name: Setup Python Environment # see https://github.com/actions/setup-python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: 'x64' @@ -116,7 +116,7 @@ jobs: run: echo "import sys; print('Python %s on %s in %s' % (sys.version, sys.platform, sys.getdefaultencoding()))" | python - name: Install poetry # see https://github.com/marketplace/actions/setup-poetry - uses: Gr1N/setup-poetry@v7 + uses: Gr1N/setup-poetry@v9 with: poetry-version: ${{ env.POETRY_VERSION }} - name: Install dependencies @@ -133,7 +133,7 @@ jobs: - name: Artifact reports if: ${{ ! cancelled() }} # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ env.REPORTS_ARTIFACT }} path: ${{ env.REPORTS_DIR }}