Skip to content

Commit

Permalink
feat: add github actions to sync and release wheel (#1154)
Browse files Browse the repository at this point in the history
Need to figure out a way to test it.
  • Loading branch information
jiashenC authored Sep 18, 2023
1 parent 11fa571 commit c95219f
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 89 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
workflow_run:
workflows: [Sync Staging and Master]
types:
- completed
branches:
- staging

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Install env.
run: |
python -m venv test_evadb
source test_evadb/bin/activate
pip install --upgrade pip
pip install ".[dev]"
- name: Create pypirc.
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cat > ~/.pypirc <<EOL
[distutils]
index-servers =
pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = ${PYPI_USERNAME}
password = ${PYPI_PASSWORD}
EOL
- name: Release.
env:
GITHUB_KEY: ${{ github.token }}
run: |
source test_evadb/bin/activate
python script/releasing/releaser.py -n minor -u
30 changes: 30 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Sync Staging and Master

on:
push:
branches:
- staging
paths:
- evadb/version.py

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install env.
run: |
python -m venv test_evadb
source test_evadb/bin/activate
pip install --upgrade pip
pip install ".[dev]"
- name: Check version and sync.
run: |
source test_evadb/bin/activate
cmd=$(python -c "from evadb.version import _REVISION; print(_REVISION if 'dev' not in _REVISION else 'skip')")
if [[ "$cmd" != "skip" ]]; then
git pull
git checkout master
git reset --hard ${{ github.sha }}
git push -f origin master
fi
4 changes: 3 additions & 1 deletion docs/source/dev-guide/release/pypi-account.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _setup_pypi_account:

Setup PyPI Account
==================

Expand All @@ -15,4 +17,4 @@ Create a .pypirc in your home directory. It should look like this:
username=YOUR_USERNAME
password=YOUR_PASSWORD
Then run ``chmod 600 ./.pypirc`` so that only you can read/write the file.
Then run ``chmod 600 ~/.pypirc`` so that only you can read/write the file.
112 changes: 112 additions & 0 deletions docs/source/dev-guide/release/release-steps-old.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
:orphan:


Release Steps
=============

1. Ensure that you're in the top-level ``eva`` directory.
2. Ensure that your branch is in sync with the ``master`` branch:

.. code-block:: bash
$ git pull origin master
3. Add a new entry in the Changelog for the release.

.. code-block:: python
## [0.0.6]
### [Breaking Changes]
### [Added]
### [Changed]
### [Deprecated]
### [Removed]
Make sure ``CHANGELOG.md`` is up to date for the release: compare against PRs
merged since the last release.

4. Update version to, e.g. ``0.0.6`` (remove the ``+dev`` label) in ``evadb/version.py``.

5. Commit these changes and create a PR:

.. code-block:: bash
git checkout -b release-v0.0.6
git add . -u
git commit -m "[RELEASE]: v0.0.6"
git push --set-upstream origin release-v0.0.6
6. Once the PR is approved, merge it and pull master locally.

7. Tag the release:

.. code-block:: bash
git tag -a v0.0.6 -m "v0.0.6 release"
git push origin v0.0.6
8. Build the source and wheel distributions:

.. code-block:: bash
rm -rf dist build # clean old builds & distributions
python3 setup.py sdist # create a source distribution
python3 setup.py bdist_wheel # create a universal wheel
9. Check that everything looks correct by installing the wheel locally and checking the version:

.. code-block:: python
python3 -m venv test_evadb # create a virtualenv for testing
source test_evadb/bin/activate # activate virtualenv
python3 -m pip install dist/evadb-0.9.1-py3-none-any.whl
python3 -c "import evadb; print(evadb.__version__)"
10. Publish to PyPI

.. code-block:: python
pip install twine # if not installed
twine upload dist/* -r pypi
11. A PR is automatically submitted (this will take a few hours) on [`conda-forge/eva-feedstock`] to update the version.
* A maintainer needs to accept and merge those changes.

12. Create a new release on Github.
* Input the recently-created Tag Version: ``v0.0.6``
* Copy the release notes in ``CHANGELOG.md`` to the GitHub tag.
* Attach the resulting binaries in (``dist/evadb-x.x.x.*``) to the release.
* Publish the release.

13. Update version to, e.g. ``0.9.1+dev`` in ``evadb/version.py``.

14. Add a new changelog entry for the unreleased version in `CHANGELOG.md`:

.. code-block:: python
## [Unreleased]
### [Breaking Changes]
### [Added]
### [Changed]
### [Deprecated]
### [Removed]
15. Commit these changes and create a PR:

.. code-block:: bash
git checkout -b bump-v0.9.1+dev
git add . -u
git commit -m "[BUMP]: v0.9.1+dev"
git push --set-upstream origin bump-v0.9.1+dev
16. Add the new tag to `the EvaDB project on ReadTheDocs <https://readthedocs.org/projects/evadb>`_,

* Trigger a build for main to pull new tags.
* Go to the ``Versions`` tab, and ``Activate`` the new tag.
* Go to Admin/Advanced to set this tag as the new default version.
* In ``Overview``, make sure a build is triggered:
* For the tag ``v0.9.1``
* For ``latest``

Credits: `Snorkel <https://github.com/snorkel-team/snorkel/blob/main/RELEASING.md>`_
108 changes: 20 additions & 88 deletions docs/source/dev-guide/release/release-steps.rst
Original file line number Diff line number Diff line change
@@ -1,109 +1,41 @@
Release Steps
=============

1. Ensure that you're in the top-level ``eva`` directory.
2. Ensure that your branch is in sync with the ``master`` branch:
.. _release_steps:

.. code-block:: bash
$ git pull origin master

3. Add a new entry in the Changelog for the release.
Release Steps
=============

.. code-block:: python
Update Version
~~~~~~~~~~~~~~~

## [0.0.6]
### [Breaking Changes]
### [Added]
### [Changed]
### [Deprecated]
### [Removed]
Update the new version number in ``evadb/version.py``.

Make sure ``CHANGELOG.md`` is up to date for the release: compare against PRs
merged since the last release.

4. Update version to, e.g. ``0.0.6`` (remove the ``+dev`` label) in ``evadb/version.py``.
Update ``master`` with ``staging``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

5. Commit these changes and create a PR:
Simply point ``master`` head to the latest commit of ``staging``.

.. code-block:: bash
git checkout -b release-v0.0.6
git add . -u
git commit -m "[RELEASE]: v0.0.6"
git push --set-upstream origin release-v0.0.6
6. Once the PR is approved, merge it and pull master locally.
git checkout master
git reset --hard <latest commit of staging>
git push -f origin master
7. Tag the release:
.. code-block:: bash
Setup Credentials
~~~~~~~~~~~~~~~~~~

git tag -a v0.0.6 -m "v0.0.6 release"
git push origin v0.0.6
Please check :ref:`setup_pypi_account` about how to setup PyPi account.

8. Build the source and wheel distributions:
Setup Github token. You can obtain a personal token from Github.

.. code-block:: bash
rm -rf dist build # clean old builds & distributions
python3 setup.py sdist # create a source distribution
python3 setup.py bdist_wheel # create a universal wheel
9. Check that everything looks correct by installing the wheel locally and checking the version:

.. code-block:: python
python3 -m venv test_evadb # create a virtualenv for testing
source test_evadb/bin/activate # activate virtualenv
python3 -m pip install dist/evadb-0.9.1-py3-none-any.whl
python3 -c "import evadb; print(evadb.__version__)"
10. Publish to PyPI

.. code-block:: python
pip install twine # if not installed
twine upload dist/* -r pypi
11. A PR is automatically submitted (this will take a few hours) on [`conda-forge/eva-feedstock`] to update the version.
* A maintainer needs to accept and merge those changes.

12. Create a new release on Github.
* Input the recently-created Tag Version: ``v0.0.6``
* Copy the release notes in ``CHANGELOG.md`` to the GitHub tag.
* Attach the resulting binaries in (``dist/evadb-x.x.x.*``) to the release.
* Publish the release.

13. Update version to, e.g. ``0.9.1+dev`` in ``evadb/version.py``.

14. Add a new changelog entry for the unreleased version in `CHANGELOG.md`:

.. code-block:: python
## [Unreleased]
### [Breaking Changes]
### [Added]
### [Changed]
### [Deprecated]
### [Removed]
export GITHUB_KEY="..."
15. Commit these changes and create a PR:
Build Wheel and Release
~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: bash
git checkout -b bump-v0.9.1+dev
git add . -u
git commit -m "[BUMP]: v0.9.1+dev"
git push --set-upstream origin bump-v0.9.1+dev
16. Add the new tag to `the EvaDB project on ReadTheDocs <https://readthedocs.org/projects/evadb>`_,

* Trigger a build for main to pull new tags.
* Go to the ``Versions`` tab, and ``Activate`` the new tag.
* Go to Admin/Advanced to set this tag as the new default version.
* In ``Overview``, make sure a build is triggered:
* For the tag ``v0.9.1``
* For ``latest``

Credits: `Snorkel <https://github.com/snorkel-team/snorkel/blob/main/RELEASING.md>`_
python script/releasing/releaser.py -n minor -u

0 comments on commit c95219f

Please sign in to comment.