File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Create version tag
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - ' pyproject.toml'
9+
10+ jobs :
11+ create-version-tag :
12+ name : Check version and create tag
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : write
16+ steps :
17+ - name : Checkout Repository
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Extract version from pyproject.toml
23+ id : get_version
24+ run : |
25+ VERSION=$(grep -m 1 '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
26+ echo "version=$VERSION" >> $GITHUB_OUTPUT
27+ echo "Extracted version: $VERSION"
28+
29+ - name : Check if tag exists
30+ id : check_tag
31+ run : |
32+ if git rev-parse "${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
33+ echo "exists=true" >> $GITHUB_OUTPUT
34+ echo "Tag '${{ steps.get_version.outputs.version }}' already exists"
35+ else
36+ echo "exists=false" >> $GITHUB_OUTPUT
37+ echo "Tag '${{ steps.get_version.outputs.version }}' does not exist"
38+ fi
39+
40+ - name : Create and push tag
41+ if : steps.check_tag.outputs.exists == 'false'
42+ run : |
43+ git config user.name "github-actions[bot]"
44+ git config user.email "github-actions[bot]@users.noreply.github.com"
45+ git tag -a "${{ steps.get_version.outputs.version }}"
46+ git push origin "${{ steps.get_version.outputs.version }}"
You can’t perform that action at this time.
0 commit comments