Skip to content

Commit 76991ab

Browse files
author
Martin Vejnár
committed
Add automatic versioning, build/release actions
1 parent ce5542c commit 76991ab

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: build
2+
on:
3+
push:
4+
branches-ignore:
5+
- release
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: avakar/derive-version@85d631f1a12b084b2592d1160b3c9154ceea7ea8
14+
id: version
15+
- run: sed -i 's/{version}/${{ steps.version.outputs.version }}+${{ github.sha }}/g' setup.py
16+
- run: python3 -m pip install setuptools wheel
17+
- run: python3 setup.py sdist bdist_wheel
18+
- uses: actions/[email protected]
19+
with:
20+
name: pe_tools-${{ steps.version.outputs.version }}+${{ github.sha }}
21+
path: dist

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- release
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: avakar/derive-version@85d631f1a12b084b2592d1160b3c9154ceea7ea8
14+
id: version
15+
- run: sed -i 's/{version}/${{ steps.version.outputs.version }}/g' setup.py
16+
- run: python3 -m pip install setuptools wheel
17+
- run: python3 -m pip install twine
18+
- run: python3 setup.py sdist bdist_wheel
19+
- uses: actions/[email protected]
20+
with:
21+
name: pe_tools-${{ steps.version.outputs.version }}
22+
path: dist
23+
- name: Upload to PyPI
24+
run: |
25+
python3 -m twine upload -u avakar -p "${{ secrets.pypi_password }}" dist/*
26+
- uses: avakar/tag-and-release@8f4b627f03fe59381267d3925d39191e27f44236
27+
with:
28+
tag_name: v${{ steps.version.outputs.version }}
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
# coding: utf-8
33

44
from setuptools import setup
5+
import os
6+
7+
top, _ = os.path.split(__file__)
8+
with open(os.path.join(top, 'VERSION'), 'r') as fin:
9+
version = fin.read().strip() + '+local'
10+
version = '{version}'.format(version=version)
511

612
setup(
713
name='pe_tools',
8-
version='0.2.8',
14+
version=version,
915

1016
url='https://github.com/avast/pe_tools',
1117
maintainer='Martin Vejnár',

0 commit comments

Comments
 (0)