Skip to content

Commit ed4026b

Browse files
nmitchkonmitchko
authored andcommitted
Merge branch 'main' of https://github.com/caretdev/django-iris into DPP-412796
2 parents 2eb5955 + b02dcb1 commit ed4026b

File tree

4 files changed

+62
-10
lines changed

4 files changed

+62
-10
lines changed

.github/workflows/python-publish.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ name: Upload Python Package
1111
on:
1212
release:
1313
types: [published]
14+
push:
15+
branches: [main]
1416

1517
jobs:
1618
deploy:
@@ -19,20 +21,63 @@ jobs:
1921

2022
steps:
2123
- uses: actions/checkout@v2
24+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
25+
if: github.event_name == 'push'
2226
- name: Set up Python
2327
uses: actions/setup-python@v2
2428
with:
2529
python-version: '3.x'
2630
- name: Install dependencies
31+
id: set-version
2732
run: |
28-
VERSION=${{ github.event.release.tag_name }}
33+
VERSION=$(grep version setup.cfg | cut -d= -f2 | tr -d '[:blank:]')
34+
[ $GITHUB_EVENT_NAME == 'release' ] && VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
35+
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=b && VERSION+=$(($(git tag -l "*$VERSION*" | cut -db -f2 | sort -n | tail -1)+1))
2936
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
3037
python -m pip install --upgrade pip
3138
pip install build
39+
echo ::set-output name=version::$VERSION
40+
NAME="django_iris"-${VERSION}-py3-none-any
41+
echo ::set-output name=name::$NAME
3242
- name: Build package
3343
run: python -m build
3444
- name: Publish package
3545
uses: pypa/gh-action-pypi-publish@release/v1.5
3646
with:
3747
user: __token__
3848
password: ${{ secrets.PYPI_API_TOKEN }}
49+
- name: Create Beta Release
50+
id: create_release
51+
if: github.event_name == 'push'
52+
uses: actions/create-release@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
tag_name: ${{ steps.set-version.outputs.version }}
57+
release_name: ${{ steps.set-version.outputs.version }}
58+
prerelease: ${{ github.event_name != 'release' }}
59+
- name: Upload Release Asset
60+
id: upload-release-asset
61+
uses: actions/upload-release-asset@v1
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ github.event_name == 'release' && github.event.release.upload_url || steps.create_release.outputs.upload_url }}
66+
asset_path: dist/${{ steps.set-version.outputs.name }}.whl
67+
asset_name: ${{ steps.set-version.outputs.name }}.whl
68+
asset_content_type: application/zip
69+
- uses: actions/checkout@v2
70+
if: github.event_name == 'release'
71+
with:
72+
ref: main
73+
- name: Bump version
74+
if: github.event_name == 'release'
75+
run: |
76+
git config --global user.name 'ProjectBot'
77+
git config --global user.email '[email protected]'
78+
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
79+
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
80+
sed -ie "s/version = .*/version = $VERSION/" setup.cfg
81+
git add setup.cfg
82+
git commit -m 'auto bump version with release'
83+
git push

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/demo
2+
/*settings.py
3+
/.vscode
4+
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
intersystems_irispython
2-
-e git+https://github.com/intersystems-community/iris-driver-distribution/raw/main/intersystems_irispython-3.2.0-py3-none-any.whl
1+
https://github.com/intersystems-community/iris-driver-distribution/raw/main/intersystems_irispython-3.2.0-py3-none-any.whl

setup.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
import re
21
from setuptools import setup
2+
import os
3+
4+
thelibFolder = os.path.dirname(os.path.realpath(__file__))
5+
requirementPath = thelibFolder + '/requirements.txt'
36

47
requirements, dependency_links = [], []
5-
with open('requirements.txt') as f:
6-
for line in f.read().splitlines():
7-
if line.startswith('-e git+'):
8-
dependency_links.append(line.replace('-e git+', ''))
9-
else:
10-
requirements.append(line)
8+
if os.path.isfile(requirementPath):
9+
with open('./requirements.txt') as f:
10+
for line in f.read().splitlines():
11+
if line.startswith('http'):
12+
dependency_links.append(line)
13+
else:
14+
requirements.append(line)
1115

1216
setup(install_requires=requirements,
1317
dependency_links=dependency_links)

0 commit comments

Comments
 (0)