Skip to content

Commit

Permalink
Merge branch 'master' into feature/repository
Browse files Browse the repository at this point in the history
# Conflicts:
#	semantic_release/cli.py
#	semantic_release/defaults.cfg
#	semantic_release/pypi.py
#	tests/test_cli.py
#	tests/test_pypi.py
#	tests/test_settings.py
  • Loading branch information
fleXible committed Nov 10, 2021
2 parents b85fec5 + 8e79fdc commit 55bdbb9
Show file tree
Hide file tree
Showing 43 changed files with 1,605 additions and 299 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -43,41 +43,48 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install mypy
run: python -m pip install mypy
- name: Install mypy & stubs packages
run: python -m pip install .[mypy]
- name: mypy
run: python -m mypy --ignore-missing-imports semantic_release

beautify:
name: Beautify
runs-on: ubuntu-latest
concurrency: push
needs: [test, mypy]
outputs:
new_sha: ${{ steps.sha.outputs.SHA }}

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9

- name: Checkout repository
uses: actions/checkout@v2

- name: Install Black
run: python -m pip install black

- name: Beautify with Black
run: python -m black .

- name: Install isort
run: python -m pip install "isort >=4,<5"

- name: Format code
run: |
python -m pip install black
python -m black .
- name: Sort imports
run: |
python -m pip install "isort >=4,<5"
python -m isort -y -rc semantic_release tests
run: python -m isort -y -rc .

- name: Commit and push changes
uses: github-actions-x/commit@v2.5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'style: improve code formatting'
commit-message: 'style: beautify ${{ github.sha }}'
name: github-actions
email: action@github.com

- name: Get new SHA
id: sha
run: |
Expand All @@ -87,6 +94,7 @@ jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
concurrency: push
needs: [test, mypy, beautify]
if: github.repository == 'relekang/python-semantic-release'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -41,8 +41,8 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install mypy
run: python -m pip install mypy
- name: Install mypy & stubs packages
run: python -m pip install .[mypy]
- name: mypy
run: python -m mypy --ignore-missing-imports semantic_release

Expand Down
136 changes: 136 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,142 @@

<!--next-version-placeholder-->

## v7.19.2 (2021-09-04)
### Fix
* Fixed ImproperConfig import error ([#377](https://github.com/relekang/python-semantic-release/issues/377)) ([`b011a95`](https://github.com/relekang/python-semantic-release/commit/b011a9595df4240cb190bfb1ab5b6d170e430dfc))

## v7.19.1 (2021-08-17)
### Fix
* Add get_formatted_tag helper instead of hardcoded v-prefix in the git tags ([`1a354c8`](https://github.com/relekang/python-semantic-release/commit/1a354c86abad77563ebce9a6944256461006f3c7))

## v7.19.0 (2021-08-16)
### Feature
* Custom git tag format support ([#373](https://github.com/relekang/python-semantic-release/issues/373)) ([`1d76632`](https://github.com/relekang/python-semantic-release/commit/1d76632043bf0b6076d214a63c92013624f4b95e))

### Documentation
* **parser:** Documentation for scipy-parser ([`45ee34a`](https://github.com/relekang/python-semantic-release/commit/45ee34aa21443860a6c2cd44a52da2f353b960bf))

## v7.18.0 (2021-08-09)
### Feature
* Add support for non-prefixed tags ([#366](https://github.com/relekang/python-semantic-release/issues/366)) ([`0fee4dd`](https://github.com/relekang/python-semantic-release/commit/0fee4ddb5baaddf85ed6b76e76a04474a5f97d0a))

### Documentation
* Clarify second argument of ParsedCommit ([`086ddc2`](https://github.com/relekang/python-semantic-release/commit/086ddc28f06522453328f5ea94c873bd202ff496))

## v7.17.0 (2021-08-07)
### Feature
* **parser:** Add scipy style parser ([#369](https://github.com/relekang/python-semantic-release/issues/369)) ([`51a3921`](https://github.com/relekang/python-semantic-release/commit/51a39213ea120c4bbd7a57b74d4f0cc3103da9f5))

## v7.16.4 (2021-08-03)
### Fix
* Correct rendering of gitlab issue references ([`07429ec`](https://github.com/relekang/python-semantic-release/commit/07429ec4a32d32069f25ec77b4bea963bd5d2a00))

## v7.16.3 (2021-07-29)
### Fix
* Print right info if token is not set (#360) ([#361](https://github.com/relekang/python-semantic-release/issues/361)) ([`a275a7a`](https://github.com/relekang/python-semantic-release/commit/a275a7a17def85ff0b41d254e4ee42772cce1981))

## v7.16.2 (2021-06-25)
### Fix
* Use release-api for gitlab ([`1ef5cab`](https://github.com/relekang/python-semantic-release/commit/1ef5caba2d8dd0f2647bc51ede0ef7152d8b7b8d))

### Documentation
* Update trove classifiers to reflect supported versions ([#344](https://github.com/relekang/python-semantic-release/issues/344)) ([`7578004`](https://github.com/relekang/python-semantic-release/commit/7578004ed4b20c2bd553782443dfd77535faa377))
* Recommend setting a concurrency group for GitHub Actions ([`34b0735`](https://github.com/relekang/python-semantic-release/commit/34b07357ab3f4f4aa787b71183816ec8aaf334a8))

## v7.16.1 (2021-06-08)
### Fix
* Tomlkit should stay at 0.7.0 ([`769a5f3`](https://github.com/relekang/python-semantic-release/commit/769a5f31115cdb1f43f19a23fe72b96a8c8ba0fc))

## v7.16.0 (2021-06-08)
### Feature
* Add option to omit tagging ([#341](https://github.com/relekang/python-semantic-release/issues/341)) ([`20603e5`](https://github.com/relekang/python-semantic-release/commit/20603e53116d4f05e822784ce731b42e8cbc5d8f))

## v7.15.6 (2021-06-08)
### Fix
* Update click and tomlkit ([#339](https://github.com/relekang/python-semantic-release/issues/339)) ([`947ea3b`](https://github.com/relekang/python-semantic-release/commit/947ea3bc0750735941446cf4a87bae20e750ba12))

## v7.15.5 (2021-05-26)
### Fix
* Pin tomlkit to 0.7.0 ([`2cd0db4`](https://github.com/relekang/python-semantic-release/commit/2cd0db4537bb9497b72eb496f6bab003070672ab))

## v7.15.4 (2021-04-29)
### Fix
* Change log level of failed toml loading ([`24bb079`](https://github.com/relekang/python-semantic-release/commit/24bb079cbeff12e7043dd35dd0b5ae03192383bb))

## v7.15.3 (2021-04-03)
### Fix
* Add venv to path in github action ([`583c5a1`](https://github.com/relekang/python-semantic-release/commit/583c5a13e40061fc544b82decfe27a6c34f6d265))

## v7.15.2 (2021-04-03)
### Fix
* Use absolute path for venv in github action ([`d4823b3`](https://github.com/relekang/python-semantic-release/commit/d4823b3b6b1fcd5c33b354f814643c9aaf85a06a))
* Set correct path for venv in action script ([`aac02b5`](https://github.com/relekang/python-semantic-release/commit/aac02b5a44a6959328d5879578aa3536bdf856c2))
* Run semantic-release in virtualenv in the github action ([`b508ea9`](https://github.com/relekang/python-semantic-release/commit/b508ea9f411c1cd4f722f929aab9f0efc0890448))

### Documentation
* Clarify that HVCS should be lowercase ([`da0ab0c`](https://github.com/relekang/python-semantic-release/commit/da0ab0c62c4ce2fa0d815e5558aeec1a1e23bc89))

## v7.15.1 (2021-03-26)
### Fix
* Add support for setting build_command to "false" ([`520cf1e`](https://github.com/relekang/python-semantic-release/commit/520cf1eaa7816d0364407dbd17b5bc7c79806086))
* Upgrade python-gitlab range ([`abfacc4`](https://github.com/relekang/python-semantic-release/commit/abfacc432300941d57488842e41c06d885637e6c))

### Documentation
* Add common options to documentation ([`20d79a5`](https://github.com/relekang/python-semantic-release/commit/20d79a51bffa26d40607c1b77d10912992279112))

## v7.15.0 (2021-02-18)
### Feature
* Allow the use of .pypirc for twine uploads ([#325](https://github.com/relekang/python-semantic-release/issues/325)) ([`6bc56b8`](https://github.com/relekang/python-semantic-release/commit/6bc56b8aa63069a25a828a2d1a9038ecd09b7d5d))

### Documentation
* Add documentation for releasing on a Jenkins instance ([#324](https://github.com/relekang/python-semantic-release/issues/324)) ([`77ad988`](https://github.com/relekang/python-semantic-release/commit/77ad988a2057be59e4559614a234d6871c06ee37))

## v7.14.0 (2021-02-11)
### Feature
* **checks:** Add support for Jenkins CI ([#322](https://github.com/relekang/python-semantic-release/issues/322)) ([`3e99855`](https://github.com/relekang/python-semantic-release/commit/3e99855c6bc72b3e9a572c58cc14e82ddeebfff8))

### Documentation
* Correct casing on proper nouns ([#320](https://github.com/relekang/python-semantic-release/issues/320)) ([`d51b999`](https://github.com/relekang/python-semantic-release/commit/d51b999a245a4e56ff7a09d0495c75336f2f150d))

## v7.13.2 (2021-01-29)
### Fix
* Fix crash when TOML has no PSR section ([#319](https://github.com/relekang/python-semantic-release/issues/319)) ([`5f8ab99`](https://github.com/relekang/python-semantic-release/commit/5f8ab99bf7254508f4b38fcddef2bdde8dd15a4c))

### Documentation
* Fix `version_toml` example for Poetry ([#318](https://github.com/relekang/python-semantic-release/issues/318)) ([`39acb68`](https://github.com/relekang/python-semantic-release/commit/39acb68bfffe8242040e476893639ba26fa0d6b5))

## v7.13.1 (2021-01-26)
### Fix
* Use multiline version_pattern match in replace ([#315](https://github.com/relekang/python-semantic-release/issues/315)) ([`1a85af4`](https://github.com/relekang/python-semantic-release/commit/1a85af434325ce52e11b49895e115f7a936e417e))

## v7.13.0 (2021-01-26)
### Feature
* Support toml files for version declaration ([#307](https://github.com/relekang/python-semantic-release/issues/307)) ([`9b62a7e`](https://github.com/relekang/python-semantic-release/commit/9b62a7e377378667e716384684a47cdf392093fa))

## v7.12.0 (2021-01-25)
### Feature
* **github:** Retry GitHub API requests on failure ([#314](https://github.com/relekang/python-semantic-release/issues/314)) ([`ac241ed`](https://github.com/relekang/python-semantic-release/commit/ac241edf4de39f4fc0ff561a749fa85caaf9e2ae))

### Documentation
* **actions:** PAT must be passed to checkout step too ([`e2d8e47`](https://github.com/relekang/python-semantic-release/commit/e2d8e47d2b02860881381318dcc088e150c0fcde))

## v7.11.0 (2021-01-08)
### Feature
* **print-version:** Add print-version command to output version ([`512e3d9`](https://github.com/relekang/python-semantic-release/commit/512e3d92706055bdf8d08b7c82927d3530183079))

### Fix
* **actions:** Fix github actions with new main location ([`6666672`](https://github.com/relekang/python-semantic-release/commit/6666672d3d97ab7cdf47badfa3663f1a69c2dbdf))
* Avoid Unknown bump level 0 message ([`8ab624c`](https://github.com/relekang/python-semantic-release/commit/8ab624cf3508b57a9656a0a212bfee59379d6f8b))
* Add dot to --define option help ([`eb4107d`](https://github.com/relekang/python-semantic-release/commit/eb4107d2efdf8c885c8ae35f48f1b908d1fced32))

## v7.10.0 (2021-01-08)
### Feature
* **build:** Allow falsy values for build_command to disable build step ([`c07a440`](https://github.com/relekang/python-semantic-release/commit/c07a440f2dfc45a2ad8f7c454aaac180c4651f70))

### Documentation
* Fix incorrect reference syntax ([`42027f0`](https://github.com/relekang/python-semantic-release/commit/42027f0d2bb64f4c9eaec65112bf7b6f67568e60))
* Rewrite getting started page ([`97a9046`](https://github.com/relekang/python-semantic-release/commit/97a90463872502d1207890ae1d9dd008b1834385))

## v7.9.0 (2020-12-21)
### Feature
* **hvcs:** Add hvcs_domain config option ([`ab3061a`](https://github.com/relekang/python-semantic-release/commit/ab3061ae93c49d71afca043b67b361e2eb2919e6))
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# This Dockerfile is only for GitHub Actions
FROM python:3.7
FROM python:3.9

ENV PYTHONPATH /semantic-release

COPY . /semantic-release

RUN cd /semantic-release && pip install .
RUN cd /semantic-release && \
python -m venv /semantic-release/.venv && \
/semantic-release/.venv/bin/pip install .

RUN python -m semantic_release.cli --help
RUN /semantic-release/.venv/bin/python -m semantic_release.cli --help

ENTRYPOINT ["/semantic-release/action.sh"]
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Python Semantic Release

|Test Status| |PyPI Version| |conda-forge version| |Read the Docs Status|

Automatic semantic versioning for python projects. This is a python
Automatic Semantic Versioning for Python projects. This is a Python
implementation of `semantic-release`_ for JS by Stephan Bönnemann. If
you find this topic interesting you should check out his `talk from
JSConf Budapest`_.
Expand Down
7 changes: 5 additions & 2 deletions action.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/sh -l
#!/bin/bash

set -el

# Copy inputs into correctly-named environment variables
export GH_TOKEN="${INPUT_GITHUB_TOKEN}"
export PYPI_TOKEN="${INPUT_PYPI_TOKEN}"
export PYPI_USERNAME="${INPUT_PYPI_USERNAME}"
export PYPI_PASSWORD="${INPUT_PYPI_PASSWORD}"
export PATH="${PATH}:/semantic-release/.venv/bin"

# Change to configured directory
cd "${INPUT_DIRECTORY}"
Expand All @@ -14,5 +17,5 @@ git config --global user.name "github-actions"
git config --global user.email "action@github.com"

# Run Semantic Release
python -m semantic_release.cli publish -v DEBUG \
/semantic-release/.venv/bin/python -m semantic_release publish -v DEBUG \
-D commit_author="github-actions <action@github.com>"
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Python Semantic Release'

description: 'Automatic semantic versioning for python projects'
description: 'Automatic Semantic Versioning for Python projects'

inputs:
directory:
Expand Down
17 changes: 12 additions & 5 deletions docs/automatic-releases/github-actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Example Workflow
jobs:
release:
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/checkout@v2
Expand All @@ -54,19 +55,25 @@ Example Workflow
It is also possible to use username and password authentication in a similar
fashion.

``concurrency`` is a
`beta feature of GitHub Actions <https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency>`_
which disallows two or more release jobs to run in parallel. This prevents race
conditions if there are multiple pushes in a short period of time.

.. warning::
You must set `fetch-depth` to 0 when using ``actions/checkout@v2``, since
Python Semantic Release needs access to the full history to determine whether
a release should be made.

.. warning::
The ``GITHUB_TOKEN`` secret is automatically configured by GitHub, with the
same permissions as the user who triggered the workflow run. This can
sometimes cause a problem if your default branch is protected, since only
administrators will be able to push to it without creating a pull request.
same permissions as the user who triggered the workflow run. This causes
a problem if your default branch is protected.

You can work around this by a user with the necessary permissions creating a
Personal Access Token, and storing that in a different secret.
You can work around this by storing an administrator's Personal Access Token
as a separate secret and using that instead of ``GITHUB_TOKEN``. In this
case, you will also need to pass the new token to ``actions/checkout`` (as
the ``token`` input) in order to gain push access.

Multiple Projects
-----------------
Expand Down
9 changes: 9 additions & 0 deletions docs/automatic-releases/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Checks for gitlab-ci to ensure that the build is on the correct branch.
The branch check, checks against the branch that gitlab-ci said it checked out, not the current
branch.

Jenkins
^^^^^^^
*Condition:* Environment variable ``JENKINS_URL`` is set.

Determines the branch name from either the environment variable ``BRANCH_NAME``
or the environment variable ``GIT_BRANCH``, and checks to ensure that the build is on
the correct branch. Also, if ``CHANGE_ID`` is set, meaning it is a PR from a multi-branch
pipeline, the build will not be automatically released.

Publish with CI
~~~~~~~~~~~~~~~
Add ``python setup.py publish`` or ``semantic-release publish`` as an after success task on your
Expand Down
Loading

0 comments on commit 55bdbb9

Please sign in to comment.