File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish version
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ create_tag :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ # Step 1: Checkout the repository
14+ - name : Checkout repository
15+ uses : actions/checkout@v3
16+ with :
17+ fetch-depth : 0
18+
19+ # Step 2: Set up Git for tagging
20+ - name : Set up Git for tagging
21+ run : |
22+ git config user.name "${{ github.actor }}"
23+ git config user.email "${{ github.actor }}@users.noreply.github.com"
24+
25+ # Step 3: Get the latest tag and increment the minor version
26+ - name : Get latest tag and increment
27+ id : get_tag
28+ run : |
29+ # Fetch all tags
30+ git fetch --tags
31+
32+ # Get the latest tag version
33+ latest_tag=$(git describe --tags --abbrev=0 || echo "v0.0.0")
34+ echo "Latest tag: $latest_tag"
35+
36+ # Extract the version numbers (major, minor, patch)
37+ major=$(echo $latest_tag | cut -d. -f1 | cut -dv -f2)
38+ minor=$(echo $latest_tag | cut -d. -f2)
39+ patch=$(echo $latest_tag | cut -d. -f3)
40+
41+ # Increment the minor version and reset patch to 0
42+ new_minor=$((minor + 1))
43+ new_version="v${major}.${new_minor}.0"
44+
45+ # Write the new version to the GITHUB_OUTPUT file for later use
46+ echo "tag=$new_version" >> $GITHUB_OUTPUT
47+
48+ # Step 4: Create and push the new tag
49+ - name : Create new tag
50+ run : |
51+ new_tag="${{ steps.get_tag.outputs.tag }}"
52+ git tag $new_tag
53+ git push origin $new_tag
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ module github.com/cloudimpl/next-coder/generator
2+
3+ go 1.22.0
4+
5+ require (
6+ github.com/fsnotify/fsnotify v1.7.0
7+ gopkg.in/yaml.v2 v2.4.0
8+ )
9+
10+ require golang.org/x/sys v0.4.0 // indirect
Original file line number Diff line number Diff line change 1+ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA =
2+ github.com/fsnotify/fsnotify v1.7.0 /go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM =
3+ golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18 =
4+ golang.org/x/sys v0.4.0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
5+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM =
6+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
7+ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY =
8+ gopkg.in/yaml.v2 v2.4.0 /go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ =
You can’t perform that action at this time.
0 commit comments