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 26cd897
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 13 deletions.
20 changes: 20 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,20 @@
[bumpversion]
current_version = 1.9.0
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:ipyvue/_version.py]

[bumpversion:file:js/package.json]
41 changes: 41 additions & 0 deletions .github/workflows/release.yaml
@@ -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 }}
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,41 @@
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:
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: Build
run: |
python setup.py bdist_wheel
- name: Install
run: pip install dist/*.whl
- name: Import
run: python -c "from ipyvuetify import Btn"
14 changes: 1 addition & 13 deletions ipyvuetify/_version.py
@@ -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
@@ -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 26cd897

Please sign in to comment.