-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare release, use poetry for publishing packages (#23)
* Prepare release, use poetry for publishing packages * Update github actions to latest versions * Remove publish steps from Makefile, fix prep step * Fix publish to devpi * Fetch master explicitly * Remove obsolete command
- Loading branch information
Showing
8 changed files
with
155 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
### How to create a new release | ||
|
||
Please follow these steps to create a new `pyconnect` release: | ||
|
||
##### 1. Checkout branch `release-prep` | ||
```shell script | ||
git checkout release-prep | ||
# or | ||
git checkout -b release-prep | ||
``` | ||
##### 2. Merge the current `master` branch into it (NOTE: the code changes are already merged into the `master` branch at this point) | ||
```shell script | ||
git checkout master | ||
git pull | ||
git checkout release-prep | ||
git merge master | ||
``` | ||
##### 3. Run `poetry version` with the appropriate argument (`major`, `minor`, `patch`) to bump the current version | ||
```shell script | ||
poetry version minor | ||
``` | ||
##### 4. Update the `CHANGELOG.md` file | ||
##### 5. Commit the changes | ||
```shell script | ||
VERSION="$(sed -n -E "s/^version = \"(.+)\"/\1/p" pyproject.toml)" | ||
git add . | ||
git commit -m "Version changed to v${VERSION}" | ||
``` | ||
##### 6. Push the changes | ||
```shell script | ||
git push | ||
``` | ||
##### 7. Open pull request to `master` on `https://github.com/real-digital/pyconnect` | ||
##### 8. Once the pull request is merged, create and publish a release. This should trigger a `publish` event that will, in turn, trigger publishing the package to `pypi` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish esque | ||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
publish-to-pypi: | ||
name: Publish to pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Setup python and install packages | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Publish to pypi | ||
if: success() | ||
run: | | ||
pip install "poetry>=1.0.2" | ||
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} | ||
poetry build | ||
poetry publish |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Verify release | ||
on: | ||
push: | ||
branches: | ||
- release-prep | ||
|
||
jobs: | ||
check-version-change: | ||
name: Check version change | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Setup python and install packages | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Check version change | ||
run: | | ||
git fetch origin master:master | ||
MASTER_VERSION="$(git show master:pyproject.toml | sed -n -E "s/^version = \"(.+)\"/\1/p")" | ||
echo "Version on master: ${MASTER_VERSION}" | ||
NEW_VERSION="$(sed -n -E "s/^version = \"(.+)\"/\1/p" pyproject.toml)" | ||
echo "Version on release-prep: ${NEW_VERSION}" | ||
(if [[ "${MASTER_VERSION}" == "${NEW_VERSION}" ]]; then | ||
echo 'Need to bump version, please run `poetry version <major|minor|patch|whatever..>`' | ||
exit 1 | ||
fi) | ||
publish-to-devpi: | ||
name: Publish to devpi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/checkout@v2 | ||
- name: Setup python and install packages | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Prepare environment for test publish | ||
if: success() | ||
run: | | ||
pip install "poetry>=1.0.2" devpi-server devpi "pluggy<1,>=0.12.0" | ||
devpi-server --serverdir=/tmp/devpi --init | ||
devpi-server --serverdir=/tmp/devpi --start | ||
scripts/wait-for-it.sh localhost:3141 -t 60 | ||
devpi use http://localhost:3141 | ||
devpi login root --password= | ||
devpi index -c root/stable bases=root/pypi volatile=True | ||
devpi user -m root password="root" | ||
mkdir -p ${HOME}/.esque | ||
poetry config repositories.devpi http://localhost:3141/root/stable/ | ||
poetry config repositories.testpypi https://test.pypi.org/legacy/ | ||
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
- name: Publish to devpi | ||
if: success() | ||
run: | | ||
poetry build | ||
poetry publish --repository devpi --username root --password root | ||
- name: Test devpi release | ||
if: success() | ||
run: | | ||
VERSION=$(sed -n -E "s/^version = \"(.+)\"/\1/p" pyproject.toml) | ||
pushd /tmp | ||
pip install setuptools | ||
pip install -i http://localhost:3141/root/stable/ --timeout 60 pyconnect | ||
CURRENT_VERSION=$(python -c 'import pkg_resources;print(pkg_resources.get_distribution("pyconnect").version)') | ||
[[ ${CURRENT_VERSION} == ${VERSION} ]] | ||
popd | ||
- name: Publish to testpypi | ||
if: success() | ||
run: | | ||
VERSION=$(sed -n -E "s/^version = \"(.+)\"/\1/p" pyproject.toml) | ||
git fetch origin master:master | ||
BUILD=$(git rev-list --count HEAD...master) | ||
sed -i -E "s/^version = .*/version = \"${VERSION}.dev${BUILD}\"/" pyproject.toml | ||
poetry build | ||
poetry publish --repository testpypi |
This file contains 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
This file contains 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
This file contains 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
This file contains 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