Skip to content

Commit

Permalink
setup release workflow, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dzakharchuk committed Jan 19, 2024
1 parent 9aac9da commit b89dd34
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 14 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mypy.ini
.gitignore
.gitlab-ci.yml
.python-version
README.md
.hooks
.lets
helm
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
name: Build & publish

# TODO: Setup release workflow
on:
push:
branches: [ "**" ]
tags:
- "v*"
# pull_request:
# branches: [main]

jobs:
deploy-client:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/client-')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python with PDM ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}

- name: Upload package to pypi.org
run: pdm publish --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }}
run: pdm publish -u "__token__" -P ${{ secrets.PYPI_TOKEN }}
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ WORKDIR /app
COPY ./pyproject.toml .
COPY ./pdm.lock .

# for pyproject.toml to extract version
COPY ./featureflags_client/__init__.py ./featureflags_client/__init__.py
# for pyproject.toml to read readme
COPY ./README.md .

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq-dev \
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ Client supports Python >=3.9.
Installation
------------

TODO:
To install package:

- ``pdm add evo-featureflags-protobuf``

To release package:

- ``VERSION=<tag> MESSAGE=<message> pdm run release"``

Development
-----------

Install dependencies:

- ``pdm install -d``

Pre-commit
Expand All @@ -26,8 +32,8 @@ Pre-commit

``./scripts/disable-hooks.sh``


TODO:

- add docs, automate docs build
- add tests
- add `tracer` / `stats_collector` for http manager
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ services:
- ./featureflags_client:/app/featureflags_client
- ./examples:/app/examples
- ./.ptpython:/app/.ptpython
- ./README.md:/app/README.md
# Uncomment to mount local build of `featureflags_protobuf`
- ./featureflags_protobuf:/app/featureflags_protobuf
#- ./featureflags_protobuf:/app/featureflags_protobuf

ishell:
<<: *base
Expand Down
1 change: 1 addition & 0 deletions featureflags_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.4.0"
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[project]
name = "evo-featureflags-client"
version = "0.4.0"
dynamic = ["version"]
description = "Feature flags client"
readme = "README.md"
authors = [
{ name = "d.zakharchuk", email = "[email protected]" },
{ name = "m.kindritskiy", email = "[email protected]" },
Expand All @@ -27,7 +28,12 @@ build-backend = "pdm.backend"

[tool.pdm]

[tool.pdm.version]
source = "file"
path = "featureflags_client/__init__.py"

[tool.pdm.scripts]
release = "./scripts/release.sh"
ishell = "ptpython --asyncio --dark-bg --history-file=.ptpython {args}"
test = "python -m pytest {args}"
docs = "sphinx-build -a -b html docs public"
Expand Down
23 changes: 23 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e
USAGE="Usage: VERSION=<> MESSAGE=<> pdm run release"

if [ -z "${VERSION}" ]; then
echo "$USAGE"
echo "VERSION is not set"
exit 1
fi
if [ -z "${MESSAGE}" ]; then
echo "$USAGE"
echo "MESSAGE is not set"
exit 1
fi

echo "Releasing ${VERSION} with message: ${MESSAGE}"

echo "__version__ = \"${VERSION}\"" > featureflags_client/__init__.py
git add featureflags_client/__init__.py
git commit -m "Release ${VERSION}"

git tag -a v${VERSION} -m "${MESSAGE}"
git push origin main --tags

0 comments on commit b89dd34

Please sign in to comment.