File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release on merge of versioned branch into main
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ branches :
7+ - main
8+
9+ jobs :
10+ release :
11+ if : github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v')
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Extract version from branch name
19+ run : echo "VERSION=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
20+
21+ - name : Set up Go
22+ uses : actions/setup-go@v5
23+ with :
24+ go-version : ' 1.24.4'
25+
26+ - name : Build with version
27+ run : go build -ldflags "-X main.Version=${VERSION}" -o req
28+
29+ - name : Tag main with version
30+ run : |
31+ git config user.name "github-actions"
32+ git config user.email "github-actions@github.com"
33+ git fetch --unshallow --tags
34+ git tag "${VERSION}"
35+ git push origin "${VERSION}"
36+
37+ - name : Create GitHub Release
38+ uses : softprops/action-gh-release@v2
39+ with :
40+ tag_name : ${{ env.VERSION }}
41+ files : req
42+ env :
43+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 3535 DB * sql.DB
3636)
3737
38+ var Version = "dev"
39+
3840func initPaths () error {
3941 // setup paths using OS-appropriate cache directory
4042 userHomeDir , err := os .UserHomeDir ()
You can’t perform that action at this time.
0 commit comments