@@ -2,10 +2,10 @@ name: Deploy and Release
22
33# Controls when the workflow will run
44on :
5- # Triggers the workflow on tag push
5+ # Triggers the workflow on version change
66 push :
7- tags :
8- - " v* "
7+ paths :
8+ - " dpath/version.py "
99
1010# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1111jobs :
1919 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2020 - uses : actions/checkout@v2
2121
22+ - name : Get Version
23+ id : get-version
24+ run : |
25+ python -c "from dpath.version import VERSION; print(f'::set-output name=version::v{VERSION}');"
26+
27+ - name : Check Tag
28+ uses : mukunku/tag-exists-action@v1.0.0
29+ id : check-tag
30+ with :
31+ tag : ${{ steps.get-version.outputs.version }}
32+ env :
33+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34+
35+ - name : Create Tag
36+ if : ${{ steps.check-tag.outputs.exists }} == "false"
37+ uses : negz/create-tag@v1
38+ with :
39+ version : ${{ steps.get-version.outputs.version }}
40+ token : ${{ secrets.GITHUB_TOKEN }}
41+
42+ - name : Generate Changelog
43+ id : generate-changelog
44+ uses : loopwerk/tag-changelog@v1
45+ with :
46+ token : ${{ secrets.GITHUB_TOKEN }}
47+
2248 - name : PyPI Deployment
2349 uses : casperdcl/deploy-pypi@v2
2450 with :
3056 build : clean sdist -d dist/
3157 # `pip` command to run ("true" is a shortcut for "wheel -w <dist_dir> --no-deps .")
3258 pip : true
33-
59+
3460 - name : Github Release
3561 uses : softprops/action-gh-release@v1
3662 with :
63+ tag_name : ${{ steps.get-version.outputs.version }}
64+ body : ${{ steps.generate-changelog.outputs.changes }}
3765 files : dist/*
0 commit comments