Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release on merge of versioned branch into main

on:
pull_request:
types: [closed]
branches:
- main

jobs:
release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v')
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract version from branch name
run: echo "VERSION=${GITHUB_HEAD_REF}" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24.4'

- name: Build with version
run: go build -ldflags "-X main.Version=${VERSION}" -o req

- name: Tag main with version
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git fetch --unshallow --tags
git tag "${VERSION}"
git push origin "${VERSION}"

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
files: req
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ var (
DB *sql.DB
)

var Version = "dev"

func initPaths() error {
// setup paths using OS-appropriate cache directory
userHomeDir, err := os.UserHomeDir()
Expand Down
Loading