Skip to content

Commit 126bcac

Browse files
chore: automate releasing
1 parent 492acf6 commit 126bcac

File tree

6 files changed

+70
-16
lines changed

6 files changed

+70
-16
lines changed

.bumpversion.cfg

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[bumpversion]
2+
current_version = 1.8.0
3+
commit = True
4+
tag = True
5+
parse = (?P<major>\d+)(\.(?P<minor>\d+))(\.(?P<patch>\d+))((?P<release>.)(?P<build>\d+))?
6+
serialize =
7+
{major}.{minor}.{patch}{release}{build}
8+
{major}.{minor}.{patch}
9+
10+
[bumpversion:part:release]
11+
optional_value = g
12+
first_value = g
13+
values =
14+
a
15+
b
16+
g
17+
18+
[bumpversion:file:ipyvue/_version.py]
19+
[bumpversion:file:js/package.json]
20+

.github/workflows/release.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Install node
14+
uses: actions/setup-node@v1
15+
with:
16+
node-version: '14.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
- name: Install Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install twine wheel jupyter-packaging jupyterlab
26+
- name: Publish the Python package
27+
env:
28+
TWINE_USERNAME: __token__
29+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
30+
run: |
31+
python setup.py sdist bdist_wheel
32+
twine upload --skip-existing dist/*
33+
- name: Publish the NPM package
34+
run: |
35+
cd js
36+
echo $PRE_RELEASE
37+
if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi
38+
npm publish --tag ${TAG} --access public
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
PRE_RELEASE: ${{ github.event.release.prerelease }}

.pre-commit-config.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 21.8b0
3+
rev: "22.8.0"
44
hooks:
55
- id: black
6-
language_version: python3.8
76
- repo: https://github.com/PyCQA/flake8
87
rev: 3.9.2
98
hooks:

ipyvue/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ._version import version_info, __version__
1+
from ._version import __version__
22
from .Html import Html
33
from .Template import Template, watch
44
from .VueWidget import VueWidget

ipyvue/_version.py

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,2 @@
1-
version_info = (1, 8, 0, "final")
2-
3-
_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
4-
5-
__version__ = "%s.%s.%s%s" % (
6-
version_info[0],
7-
version_info[1],
8-
version_info[2],
9-
""
10-
if version_info[3] == "final"
11-
else _specifier_[version_info[3]] + str(version_info[4]),
12-
)
13-
1+
__version__ = "1.8.0"
142
semver = "^" + __version__

release.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
# usage: ./release minor -n
4+
version=$(bump2version --dry-run --list $* | grep new_version | sed -r s,"^.*=",,)
5+
echo Version tag v$version
6+
bumpversion $* --verbose && git push upstream master v$version

0 commit comments

Comments
 (0)