Skip to content

Commit c9ff699

Browse files
committed
release(release): improve tag handling and arm build support
Signed-off-by: Tommy Nguyen <tuannvm@hotmail.com>
1 parent 81a8ecb commit c9ff699

File tree

4 files changed

+21
-44
lines changed

4 files changed

+21
-44
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,22 @@ jobs:
6060
id: extract_version
6161
if: steps.semantic.outcome == 'success'
6262
run: |
63-
VERSION=$(git describe --tags --abbrev=0)
63+
VERSION=$(git describe --tags --abbrev=0 --always)
6464
VERSION=${VERSION#v}
6565
echo "version=$VERSION" >> $GITHUB_OUTPUT
6666
echo "Released version: $VERSION"
67+
# Dynamically set the tag name for use in later steps
68+
TAG_NAME="v$VERSION"
69+
echo "tag_name=$TAG_NAME" >> $GITHUB_ENV
70+
71+
- name: Validate Git Tag
72+
run: |
73+
TAG_NAME=${{ env.TAG_NAME }}
74+
EXISTING_TAG=$(git tag --points-at ${GITHUB_SHA})
75+
if [ "$EXISTING_TAG" != "$TAG_NAME" ]; then
76+
git tag -f $TAG_NAME ${GITHUB_SHA}
77+
git push origin $TAG_NAME --force
78+
fi
6779
6880
- name: Run GoReleaser
6981
uses: goreleaser/goreleaser-action@v6
@@ -75,6 +87,7 @@ jobs:
7587
env:
7688
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7789
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
90+
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
7891
GORELEASER_CURRENT_TAG: v${{ steps.extract_version.outputs.version }}
7992

8093

.goreleaser.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Configuration version removed to avoid parsing issues with v1.18.2
1+
# GoReleaser configuration
22
before:
33
hooks:
44
- go mod tidy
55

66
builds:
77
- main: ./cmd/server/main.go
8-
binary: mcp-trino
8+
binary: "{{ .ProjectName }}"
99
env:
1010
- CGO_ENABLED=0
1111
goos:
@@ -15,14 +15,15 @@ builds:
1515
goarch:
1616
- amd64
1717
- arm64
18+
- arm
1819
ldflags:
1920
- -s -w -X main.Version={{.Version}}
2021

2122
archives:
2223
- format_overrides:
2324
- goos: windows
2425
format: zip
25-
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
26+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
2627

2728
checksum:
2829
name_template: "checksums.txt"
@@ -46,22 +47,7 @@ changelog:
4647
release:
4748
github:
4849
owner: "{{.Env.GITHUB_REPOSITORY_OWNER}}"
49-
name: "mcp-trino"
50+
name: "{{.Env.GITHUB_REPOSITORY_NAME}}"
5051
draft: false
5152
prerelease: auto
5253
name_template: "{{.ProjectName}} v{{.Version}}"
53-
54-
# Update Docker configuration to be compatible with most GoReleaser versions
55-
dockers:
56-
- image_templates:
57-
- "ghcr.io/{{.Env.GITHUB_REPOSITORY_OWNER}}/mcp-trino:{{ .Version }}"
58-
- "ghcr.io/{{.Env.GITHUB_REPOSITORY_OWNER}}/mcp-trino:latest"
59-
dockerfile: Dockerfile.goreleaser
60-
build_flag_templates:
61-
- "--pull"
62-
- "--label=org.opencontainers.image.created={{.Date}}"
63-
- "--label=org.opencontainers.image.title={{.ProjectName}}"
64-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
65-
- "--label=org.opencontainers.image.version={{.Version}}"
66-
# Simplified Docker configuration
67-
skip_push: false

Dockerfile.goreleaser

Lines changed: 0 additions & 23 deletions
This file was deleted.

release.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module.exports = {
1414
{ type: 'refactor', release: 'patch' },
1515
{ type: 'chore', scope: 'deps', release: 'patch' },
1616
// Consider any changes to Go files as a patch release (fallback)
17-
{ files: ['**/*.go'], release: 'patch' }
17+
{ files: ['**/*.go'], release: 'patch' },
18+
{ type: 'release', release: 'patch' }
1819
]
1920
}
2021
],

0 commit comments

Comments
 (0)