Skip to content

Commit 3d4f5ab

Browse files
committed
ci: github action to release to pypi
1 parent b7b979d commit 3d4f5ab

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
- workflow_dispatch
3+
4+
name: Release packages
5+
6+
jobs:
7+
build:
8+
name: Create the package
9+
runs-on: ubuntu-latest
10+
environment: github_release
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.9
17+
18+
- id: sdist
19+
run: python setup.py sdist
20+
21+
- id: version
22+
run: |
23+
printf "::set-output name=version::%s\n" $(python -c "import runpy; print(runpy.run_path('dict2xml/__init__.py')['VERSION'])")
24+
printf "::set-output name=versiondash::%s\n" $(python -c "import runpy; print(runpy.run_path('dict2xml/__init__.py')['VERSION'].replace('.', '-'))")
25+
26+
- id: package
27+
run: >
28+
printf "::set-output name=package::dict2xml-${{ steps.version.outputs.version}}.tar.gz"
29+
30+
- id: create_release
31+
uses: actions/create-release@v1
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
35+
with:
36+
tag_name: "release-${{ steps.version.outputs.version }}"
37+
release_name: dict2xml ${{ steps.version.outputs.version }}
38+
body: "https://github.com/delfick/python-dict2xml#release-${{ steps.version.outputs.versiondash }}"
39+
draft: false
40+
prerelease: false
41+
42+
- id: upload-release-asset
43+
uses: actions/upload-release-asset@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
upload_url: ${{ steps.create_release.outputs.upload_url }}
48+
asset_path: "dist/${{ steps.package.outputs.package }}"
49+
asset_name: ${{ steps.package.outputs.package }}
50+
asset_content_type: application/tar+gzip
51+
52+
- uses: pypa/gh-action-pypi-publish@v1.4.1
53+
with:
54+
user: __token__
55+
password: ${{ secrets.PYPI_API_TOKEN_CORE }}
56+
packages_dir: dist

dict2xml/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from dict2xml.logic import Converter, Node
22

3+
VERSION = "1.7.1"
4+
35

46
def dict2xml(data, *args, **kwargs):
57
"""Return an XML string of a Python dict object."""

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
from dict2xml import VERSION
12
from setuptools import setup
23

34
# fmt: off
45

56
# Setup the project
67
setup(
78
name = "dict2xml"
8-
, version = '1.7.0'
9+
, version = VERSION
910
, packages = ['dict2xml']
1011

1112
, python_requires = ">= 3.5"

0 commit comments

Comments
 (0)