-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 1.75 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: deploy monzo-utils
on: push
defaults:
run:
shell: bash
jobs:
push_sieve:
name: deploy monzo-utils
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetches all history for all tags and branches
- name: build monzo-utils
run: |
latest_release=`curl -s https://pypi.org/pypi/monzo-utils/json | jq -r '.info.version'`
version=`grep '^##' CHANGELOG.md |head -n1 |cut -d ' ' -f2`
if [ "$latest_release" != "$version" ] ; then
mkdir venv
python3 -m venv venv
source venv/bin/activate
pip3 install twine wheel
if [ -e dist ] ; then
rm -f dist/*
fi
python3 setup.py bdist_wheel
fi
- name: deploy to pypi
run: |
latest_release=`curl -s https://pypi.org/pypi/monzo-utils/json | jq -r '.info.version'`
version=`grep '^##' CHANGELOG.md |head -n1 |cut -d ' ' -f2`
if [ "$latest_release" != "$version" ] ; then
source venv/bin/activate
twine upload dist/*.whl
fi
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- name: create github release
run: |
latest_release=`curl -s https://pypi.org/pypi/monzo-utils/json | jq -r '.info.version'`
version=`grep '^##' CHANGELOG.md |head -n1 |cut -d ' ' -f2`
if [ "$latest_release" != "$version" ] ; then
change=`awk '/^## /{if (p) exit; p=1} p && /^- /' CHANGELOG.md`
gh release create $version --target master --notes "$change"
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}