Skip to content

Commit

Permalink
chore: setup automated releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Apr 3, 2023
1 parent e43d14f commit e241012
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 14 deletions.
20 changes: 20 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[bumpversion]
current_version = 1.8.5
commit = True
tag = True
parse = (?P<major>\d+)(\.(?P<minor>\d+))(\.(?P<patch>\d+))((?P<release>.)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}{release}{build}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = g
first_value = g
values =
a
b
g

[bumpversion:file:ipyvuetify/_version.py]

[bumpversion:file:js/package.json]
41 changes: 41 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Package

on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine wheel jupyter-packaging jupyterlab
- name: Publish the Python package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload --skip-existing dist/*
- name: Publish the NPM package
run: |
cd js
echo $PRE_RELEASE
if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi
npm publish --tag ${TAG} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PRE_RELEASE: ${{ github.event.release.prerelease }}
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

on:
- push
- pull_request
- workflow_dispatch

jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine wheel jupyter-packaging jupyterlab
- name: Build
run: |
python setup.py bdist_wheel
- name: Install
run: pip install dist/*.whl
- name: Import
run: python -c "from ipyvuetify import Btn"
2 changes: 1 addition & 1 deletion ipyvuetify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._version import __version__, version_info # noqa: F401
from ._version import __version__ # noqa: F401
from .generated import * # noqa: F401, F403
from .Html import Html # noqa: F401
from .Themes import theme # noqa: F401
Expand Down
14 changes: 1 addition & 13 deletions ipyvuetify/_version.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
version_info = (1, 8, 5, "final")

_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}

__version__ = "%s.%s.%s%s" % (
version_info[0],
version_info[1],
version_info[2],
""
if version_info[3] == "final"
else _specifier_[version_info[3]] + str(version_info[4]),
)

__version__ = "1.8.5"
semver = "^" + __version__
6 changes: 6 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e -o pipefail
# usage: ./release minor -n
version=$(bump2version --dry-run --list $* | grep new_version | sed -r s,"^.*=",,)
echo Version tag v$version
bumpversion $* --verbose && git push upstream master v$version

0 comments on commit e241012

Please sign in to comment.