From a25636803830d585780ef314171c28042c5b6089 Mon Sep 17 00:00:00 2001 From: Adil Ansari Date: Fri, 19 May 2023 13:06:29 -0700 Subject: [PATCH 1/2] ops: ci releases (#22) * chore: release wflow to pypi * fixing prerelease config --- .github/workflows/ci.yml | 2 ++ .github/workflows/release.yml | 67 +++++++++++++++++++++++++++++++++++ .releaserc.json | 52 +++++++++++++++++++++++++++ pyproject.toml | 2 +- reviewpad.yml | 2 +- 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c34bc1..6d91aaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ on: push: branches: - main + workflow_call: + jobs: lint: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff272a2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: release +on: + push: + branches: + - "release/stable" + - "release/beta" + - "release/next" + +permissions: + contents: read # for checkout + +jobs: + build: + uses: ./.github/workflows/ci.yml + release-dry-run: + needs: build + name: Release + runs-on: ubuntu-latest + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for npm provenance + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: recursive + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "lts/*" + - name: Install semantic release + run: npm install --no-save semantic-release @semantic-release/exec conventional-changelog-conventionalcommits + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + - name: Install dependencies if cache miss + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + - name: Install dependencies if poetry.lock changed + run: poetry install --no-interaction + - name: Compile proto to generate API stubs + run: | + source $VENV + poetry run make generate + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYPI_REPO: "https://upload.pypi.org/legacy/" + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + source $VENV + npx semantic-release --debug diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..14edd35 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,52 @@ +{ + "branches": [ + "release/stable", + { + "name": "release/beta", + "channel": "beta", + "prerelease": "beta" + }, + { + "name": "release/next", + "channel": "next", + "prerelease": "rc" + } + ], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/exec", + { + "verifyConditionsCmd": "if [ 403 != $(curl -X POST -F \":action=file_upload\" -u __token__:$PYPI_TOKEN -s -o /dev/null -w \"%{http_code}\" $PYPI_REPO) ]; then (exit 0); else (echo \"Authentication error. Please check the PYPI_TOKEN environment variable.\" && exit 1); fi", + "prepareCmd": "poetry version ${nextRelease.version}", + "publishCmd": "poetry config repositories.repo $PYPI_REPO && poetry publish --build --repository repo --username __token__ --password $PYPI_TOKEN --no-interaction -vvv" + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "dist/*.tar.gz", + "label": "sdist" + }, + { + "path": "dist/*.whl", + "label": "wheel" + } + ] + } + ] + ] +} diff --git a/pyproject.toml b/pyproject.toml index 561d424..add9504 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Tigris team "] repository = "https://www.github.com/tigrisdata/tigris-client-python" documentation = "https://www.tigrisdata.com/docs/" classifiers = [ - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Topic :: Database" diff --git a/reviewpad.yml b/reviewpad.yml index 5dfd8ae..e414f4c 100644 --- a/reviewpad.yml +++ b/reviewpad.yml @@ -1,7 +1,7 @@ # Define the list of rules to be used by Reviewpad. rules: - name: is-release-branch - spec: $base() == "beta" || $base() == "alpha" || $base() == "release" + spec: $base() == "release/beta" || $base() == "release/stable" || $base() == "release/next" - name: is-main-branch spec: $base() == "main" From 49142388cf354626005e9688c006d6caf6263ac0 Mon Sep 17 00:00:00 2001 From: Adil Ansari Date: Fri, 19 May 2023 13:14:32 -0700 Subject: [PATCH 2/2] feat: commit to trigger release (#23) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index eba75e4..ba810c2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Python client for Tigris +## Installation + +```commandline +pip install tigris-client-python>=1.0.0.b1 +``` + # Usage See reference implementation in `./tests` directory that uses Tigris on `localhost:8081`