File tree 2 files changed +50
-0
lines changed
2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+ from packaging .version import parse
4
+
5
+ print (sys .version_info )
6
+ tag_ref = sys .argv [1 ]
7
+ tag_name = tag_ref .split ("/" )[- 1 ]
8
+ print (f"tag_name: { tag_name } " )
9
+ version = parse (tag_name )
10
+ print (f"version: { version } " )
11
+ if not (version .is_prerelease ):
12
+ print ("Creating new major and minor tags!" )
13
+ print (f"::set-output name=original_tag_name::{ tag_name } " )
14
+ print (f"::set-output name=major_version::v{ version .major } " )
15
+ print (f"::set-output name=minor_version::v{ version .major } .{ version .minor } " )
16
+ else :
17
+ print ("No tags created (dev or pre version)!" )
Original file line number Diff line number Diff line change
1
+ name : " Publish Major-Minor-Tags"
2
+ on :
3
+ push :
4
+ tags :
5
+ - " v*"
6
+
7
+ jobs :
8
+ push-tags :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+ - name : Set up Python 3.8
13
+ uses : actions/setup-python@v2
14
+ with :
15
+ python-version : 3.8
16
+ - name : Install packaging
17
+ run : pip install -U packaging
18
+ - name : Get versions
19
+ id : get_versions
20
+ run : python .github/workflows/publish-major-minor.py ${{ github.ref }}
21
+ - name : Push Tags Version
22
+ if : steps.get_versions.outputs.original_tag_name != ''
23
+ env :
24
+ original_tag_name : ${{ steps.get_versions.outputs.original_tag_name }}
25
+ major_version : ${{ steps.get_versions.outputs.major_version }}
26
+ minor_version : ${{ steps.get_versions.outputs.minor_version }}
27
+ run : |
28
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
29
+ git config --global user.name "github-actions[bot]"
30
+ git tag -a $major_version -m "original tag: $original_tag_name"
31
+ git tag -a $minor_version -m "original tag: $original_tag_name"
32
+ git push origin $major_version -f
33
+ git push origin $minor_version -f
You can’t perform that action at this time.
0 commit comments