Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Release pipeline #122

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tool.bumpversion]
current_version = "0.1.0"

[[tool.bumpversion.files]]
filename = "pyproject.toml"
20 changes: 16 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Documentation
on:
push:
branches: [main]
release:
types: [published]
workflow_dispatch:

permissions:
contents: write
Expand All @@ -15,13 +18,11 @@ jobs:
uses: actions/checkout@v4
with:
lfs: "true"
fetch-depth: 0 # fetch all commits/branches
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand All @@ -30,4 +31,15 @@ jobs:
- name: Install
run: |
pip install ".[dev]"
- run: mkdocs gh-deploy --force
- name: Get Current Version
if: ${{ github.event_name == 'release' }}
run: |
export CURRENT_VERSION=$(bump-my-version show current_version)
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
shell: bash
- name: Publish release
if: ${{ github.event_name == 'release' }}
run: mike deploy --push --update-aliases ${{ env.CURRENT_VERSION }} latest
- name: Publish development
if: ${{ github.event_name == 'push' }}
run: mike deploy development --push
38 changes: 38 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish package

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
concurrency:
group: publish
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: "true"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: "pip"
- name: Install
run: |
pip install ".[dev]"
- name: Get Current Version
run: |
export CURRENT_VERSION=$(bump-my-version show current_version)
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
shell: bash
- name: Build and publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --upgrade build twine
python3 -m build
python3 -m twine upload --verbose --non-interactive dist/*
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,20 @@ dark mode, add the tag *invertible-output*, i.e.
]
```
This applies a simple CSS-filter to the output image of the cell.


## Release process

In order to create a new release, make sure that the project's venv is active
and the repository is clean and on the main branch.

Create a new release using the script `build_scripts/release.sh`.
This script will create a release tag on the repository and bump
the version number:

```shell
./build_scripts/release.sh
```

Afterwards, create a GitHub release for that tag. That will a trigger a CI
pipeline that will automatically create a package and publish it from CI to PyPI.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ operator learning is particularly useful in scientific machine learning,
relevant benchmarks.

## Installation
Clone the repository and install the package using pip.
Install the package using pip:
```shell
pip install continuiti
```

Or install the latest development version from the repository:

```
git clone https://github.com/aai-institute/continuiti.git
cd continuiti
pip install -e .
pip install -e .[dev]
```

## Usage
Expand Down
17 changes: 17 additions & 0 deletions build_scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Usage: ./build_scripts/release.sh

RELEASE_VERSION=$(bump-my-version show current_version)
MAIN=main

echo "Checking out $MAIN branch"
git checkout $MAIN
git pull origin $MAIN

echo "Creating tag $RELEASE_BRANCH"
git tag -a "$RELEASE_VERSION" -m "Release ${RELEASE_VERSION}"
git push --tags origin $MAIN

echo "Bumping to next patch version"
bump-my-version bump --commit patch

git push origin $MAIN
7 changes: 3 additions & 4 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ alias:

# Installing continuiti

To install the latest development version use:
Install the latest version of **continuiti** using pip:
```
git clone https://github.com/aai-institute/continuiti.git
cd continuiti
pip install -e .
pip install continuiti
```


## Dependencies

**continuiti** requires Python>=3.9 and is built on top of
Expand Down
9 changes: 4 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ plugins:
caption_position: bottom
- macros
- mike:
canonical_version: stable
canonical_version: latest
- search
- section-index
- alias:
use_relative_link: true
verbose: true
- gen-files:
scripts:
Expand Down Expand Up @@ -131,12 +130,12 @@ extra:
copyright_link: https://appliedai-institute.de
version:
provider: mike
default: stable
default: latest
social:
- icon: fontawesome/brands/github
link: https://github.com/aai-institute/continuiti
# - icon: fontawesome/brands/python
# link: https://pypi.org/project/continuiti/
- icon: fontawesome/brands/python
link: https://pypi.org/project/continuiti/
- icon: fontawesome/brands/twitter
link: https://twitter.com/appliedAI_gGmbH
- icon: fontawesome/brands/linkedin
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ keywords = [
"Artificial Intelligence", "Machine Learning", "Mathematics", "Physics",
"Operator Learning", "Physics-Informed ML", "Neural Operator", "DeepONet",
]
dynamic = ["version"]
version = "0.1.0"
dependencies = [
"setuptools",
"numpy",
Expand Down Expand Up @@ -68,14 +68,14 @@ dev = [
"mknotebooks>=0.8.0",
"neoteroi-mkdocs",
"pygments",
]

[tool.setuptools.dynamic]
version = {attr = "continuiti.__version__"}
# === Releasing ===
"bump-my-version",
]

[tool.setuptools.packages.find]
where = ["src"]
include = ["continuiti"]
include = ["continuiti*"]

[project.urls]
Repository = "https://github.com/aai-institute/continuiti.git"
Expand Down
1 change: 0 additions & 1 deletion src/continuiti/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
::/cards::

"""
__version__ = "0.0.0"

__all__ = [
"benchmarks",
Expand Down
Loading