Skip to content

Commit

Permalink
chore(ci): fix release workflow (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Jul 23, 2024
1 parent 7b4598d commit ed79d8a
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 10 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
paths:
- "VERSION"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"

- name: Build
run: go build -v ./...

- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
version="v$(cat VERSION)"
if gh release view ${version} > /dev/null 2>&1; then
echo "Release ${version} already exists. Skipping release creation."
else
echo "Creating release ${version}."
gh release create ${version} --generate-notes
fi
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.6.8
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/avast/retry-go v3.0.0+incompatible
github.com/google/uuid v1.3.0
github.com/pkg/errors v0.9.1
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.4
github.com/test-go/testify v1.1.4
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
11 changes: 7 additions & 4 deletions restful.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ const (
Kill
)

type ContextKey string

const (
ContextKeyQueryID string = "X-DATABEND-QUERY-ID"
ContextUserAgentID string = "USER-AGENT"
EMPTY_FIELD_AS string = "empty_field_as"
PURGE string = "purge"
ContextKeyQueryID ContextKey = "X-DATABEND-QUERY-ID"
ContextUserAgentID ContextKey = "USER-AGENT"

EMPTY_FIELD_AS string = "empty_field_as"
PURGE string = "purge"
)

type PresignedResponse struct {
Expand Down
3 changes: 1 addition & 2 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
minio:
image: docker.io/minio/minio
Expand All @@ -7,7 +6,7 @@ services:
volumes:
- ./data:/data
databend:
image: datafuselabs/databend:v1.2.367-nightly
image: datafuselabs/databend
environment:
- QUERY_DEFAULT_USER=databend
- QUERY_DEFAULT_PASSWORD=databend
Expand Down
7 changes: 6 additions & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
package godatabend

var version = "0.6.6"
import (
_ "embed"
)

//go:embed VERSION
var version string
16 changes: 16 additions & 0 deletions version_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package godatabend

import (
"os"
"testing"

"github.com/stretchr/testify/require"
)

func TestVersion(t *testing.T) {
r := require.New(t)
content, err := os.ReadFile("VERSION")
r.NoError(err)

r.Equal(string(content), version)
}

0 comments on commit ed79d8a

Please sign in to comment.