Skip to content
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
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Description

Add a short description of the change. If this is related to an issue, please add a reference to the issue.

## CHANGELOG

* [CHANGED] Describe your change here. Look at CHANGELOG.md to see the format.
27 changes: 0 additions & 27 deletions .github/worflows/test.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Github Release

on:
push:
branches: [ master ]

jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup git
run: |
git config user.email "[email protected]"
git config user.name "MessageBird CI"
- name: Prepare description
run: |
awk '/^## / { if (p) { exit }; { p=1; next } } p && NF' CHANGELOG.md > CHANGELOG.tmp
- name: Prepare tag
run: |
export TAG=$(awk '/^## / {print $2}' CHANGELOG.md)
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: Version ${{ env.TAG }}
body_path: CHANGELOG.tmp
draft: false
prerelease: false
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Python release

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release

on:
pull_request_target:
# Do not remove types labels to avoid security issue, see link for more info:
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/#:~:text=Add%20a%20condition%20to%20the,to%20the%20target%20repository:
types: [ labeled ]
branches:
- master

jobs:
prepare-release:
name: Prepare release
runs-on: ubuntu-latest

steps:
- name: Set major release
if: ${{ github.event.label.name == 'release-major' }}
run: echo "RELEASE=major" >> $GITHUB_ENV
- name: Set minor release
if: ${{ github.event.label.name == 'release-minor' }}
run: echo "RELEASE=minor" >> $GITHUB_ENV
- name: Set patch release
if: ${{ github.event.label.name == 'release-patch' }}
run: echo "RELEASE=patch" >> $GITHUB_ENV
- name: Check release env
run: |
if [[ -z "${{ env.RELEASE }}" ]];
then
echo "You need to set a release label on PRs to the main branch"
exit 1
else
exit 0
fi
- name: Install semver-tool
run: |
export DIR=$(mktemp -d)
cd $DIR
curl https://github.com/fsaintjacques/semver-tool/archive/3.2.0.tar.gz -L -o semver.tar.gz
tar -xvf semver.tar.gz
sudo cp semver-tool-3.2.0/src/semver /usr/local/bin
- name: Bump version
run: |
export CURRENT=$(curl -s https://pypi.org/simple/messagebird/ | grep -o "messagebird-[0-9]*\.[0-9]*\.[0-9]*\.tar\.gz" | tail -1 | grep -o "[0-9]*\.[0-9]*\.[0-9]*")
export NEW_VERSION=$(semver bump ${{ env.RELEASE }} $CURRENT)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Prepare CHANGELOG
run: |
echo "${{ github.event.pull_request.body }}" | csplit -s - "/##/"
echo "# Changelog
## ${{ env.VERSION }}
" >> CHANGELOG.tmp
grep "^*" xx01 >> CHANGELOG.tmp
grep -v "^# " CHANGELOG.md >> CHANGELOG.tmp
cp CHANGELOG.tmp CHANGELOG.md
- name: Prepare version.py
run: |
sed -i "s|VERSION = '[^']*'|VERSION = '${{ env.VERSION }}'|" messagebird/version.py
- name: Commit changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "MessageBird CI"
git add CHANGELOG.md messagebird/version.py
git commit -m "Bump to version ${{ env.VERSION }}"
- name: Push
run: git push
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

## 2.0.0

* [FIXED] Encoding issue when JSON is serialized.
* [ADDED] Voice recording deletion API.
* [ADDED] Verify create email.
* [CHANGED] Drop python 2 support.
7 changes: 3 additions & 4 deletions messagebird/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
from messagebird.voice_transcription import VoiceTranscriptionsList, VoiceTranscriptionsView
from messagebird.call_flow import CallFlow, CallFlowList, CallFlowNumberList
from messagebird.number import Number, NumberList
from messagebird.version import VERSION

ENDPOINT = 'https://rest.messagebird.com'
CLIENT_VERSION = '2.0.0'
PYTHON_VERSION = '%d.%d.%d' % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
USER_AGENT = 'MessageBird/ApiClient/%s Python/%s' % (CLIENT_VERSION, PYTHON_VERSION)
USER_AGENT = 'MessageBird/ApiClient/%s Python/%s' % (VERSION, PYTHON_VERSION)
REST_TYPE = 'rest'

CONVERSATION_API_ROOT = 'https://conversations.messagebird.com/v1/'
Expand Down Expand Up @@ -62,7 +62,6 @@ def __init__(self, errorMessage):
super(SignleErrorException, self).__init__(errorMessage)



class Client(object):
def __init__(self, access_key, http_client=None):
self.access_key = access_key
Expand Down Expand Up @@ -290,7 +289,7 @@ def verify_create_email(self, recipient, originator, params=None):
if params is None:
params = {}
params.update({
'type' : 'email',
'type': 'email',
'recipient': recipient,
'originator': originator
})
Expand Down
1 change: 1 addition & 0 deletions messagebird/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = '2.0.0'
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
from os import path
import os
import re
from setuptools import setup
from io import open

with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'messagebird/version.py'), 'r') as fd:
VERSION = re.search(r'^VERSION = [\']([^\']*)[\']',
fd.read(), re.MULTILINE).group(1)

if not VERSION:
raise RuntimeError('Ensure `VERSION` is correctly set in ./messagebird/version.py')

with open('README.md', encoding='utf-8') as f:
description = f.read()

setup(
name = 'messagebird',
packages = ['messagebird'],
version = '2.0.0',
version = VERSION,
description = "MessageBird's REST API",
author = 'MessageBird',
author_email = '[email protected]',
long_description = description,
long_description_content_type = 'text/markdown',
url = 'https://github.com/messagebird/python-rest-api',
download_url = 'https://github.com/messagebird/python-rest-api/tarball/2.0.0',
keywords = ['messagebird', 'sms'],
install_requires = ['requests>=2.4.1', 'python-dateutil>=2.6.0', 'pyjwt>=2.1.0'],
extras_require = {
Expand Down