-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from OpenMined/versioning
Add versioning
- Loading branch information
Showing
8 changed files
with
143 additions
and
3 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,9 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+) | ||
serialize = | ||
{major}.{minor}.{patch} | ||
|
||
[bumpversion:file:pyproject.toml] | ||
|
||
[bumpversion:file:syftbox/__version__.py] |
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,73 @@ | ||
name: CD - SyftBox | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bump_type: | ||
description: "Version bump type" | ||
type: choice | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
test_bump: | ||
description: "Perform a test bump version without pushing to pypi and repo" | ||
type: boolean | ||
default: false | ||
|
||
# Prevents concurrent runs of the same workflow | ||
# while the previous run is still in progress | ||
concurrency: | ||
group: "CD - SyftBox" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy-syftbox: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout SyftBox repo with github token | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.SYFTBOX_BOT_COMMIT_TOKEN }} | ||
|
||
- name: Configure git user | ||
run: | | ||
git config user.name "${{ secrets.OM_BOT_NAME }}" | ||
git config user.email "${{ secrets.OM_BOT_EMAIL }}" | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install uv==0.4.19 twine | ||
uv --version | ||
- name: Install Just | ||
uses: extractions/setup-just@v2 | ||
with: | ||
just-version: "1.36.0" | ||
|
||
- name: Bump the Version | ||
run: | | ||
just bump-version ${{ inputs.bump_type }} | ||
- name: Build syftbox | ||
run: | | ||
just build | ||
- name: Push to pypi | ||
if: ${{ inputs.test_bump == false }} | ||
run: | | ||
twine upload -u __token__ -p ${{ secrets.OM_SYFTBOX_PYPI_TOKEN }} dist/* | ||
- name: Push changes to SyftBox repo | ||
if: ${{ inputs.test_bump == false }} | ||
run: | | ||
git push origin main |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,34 @@ deploy keyfile remote="[email protected]": build | |
|
||
echo -e "{{ _green }}Deploy successful!{{ _nc }}" | ||
|
||
# Bump version, commit and tag | ||
[group('build')] | ||
bump-version level="patch": | ||
#!/bin/bash | ||
# We need to uv.lock before we can commit the whole thing in the repo. | ||
# DO not bump the version on the uv.lock file, else other packages with same version might get updated | ||
|
||
set -eou pipefail | ||
|
||
# sync everything | ||
uv sync --extra dev | ||
|
||
# get the current and new version | ||
BUMPVERS_CHANGES=$(uv run bump2version --dry-run --allow-dirty --list {{ level }}) | ||
CURRENT_VERSION=$(echo "$BUMPVERS_CHANGES" | grep current_version | cut -d'=' -f2) | ||
NEW_VERSION=$(echo "$BUMPVERS_CHANGES" | grep new_version | cut -d'=' -f2) | ||
echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION" | ||
|
||
# first bump version | ||
uv run bump2version {{ level }} | ||
|
||
# update uv.lock file to reflect new package version | ||
uv lock | ||
|
||
# commit the changes | ||
git commit -am "Bump version $CURRENT_VERSION -> $NEW_VERSION" | ||
git tag -a $NEW_VERSION -m "Release $NEW_VERSION" | ||
|
||
# --------------------------------------------------------------------------------------------------------------------- | ||
|
||
[group('utils')] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
__version__ = "0.1.0" | ||
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,11 @@ | ||
# ____ __ _ ____ | ||
# / ___| _ _ / _| |_| __ ) _____ __ | ||
# \___ \| | | | |_| __| _ \ / _ \ \/ / | ||
# ___) | |_| | _| |_| |_) | (_) > < | ||
# |____/ \__, |_| \__|____/ \___/_/\_\ | ||
# |___/ | ||
|
||
__title__ = "SyftBox" | ||
__description__ = "" | ||
__url__ = "https://openmined.org" | ||
__version__ = "0.1.0" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.