Skip to content

Commit 2e1c200

Browse files
authored
Merge pull request #23 from libost/dev
Release 1.9.3
2 parents bd012e7 + ee9700c commit 2e1c200

26 files changed

Lines changed: 295 additions & 175 deletions

.dockerignore

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1+
# Ignore git related files
12
.git
23
.gitignore
34
.github
5+
6+
# Ignore build artifacts and database files
7+
sticker_go
8+
*.exe
9+
*.old
10+
dist
11+
12+
# Ignore local development files
413
cache
514
logs
615
data
716
*.db
817
*.log
918
config.yaml
10-
sticker_go
11-
main
19+
*.sh
20+
*.ps1
21+
22+
# Ignore documentation and editor files
1223
README.md
1324
README_zh.md
1425
docs
15-
.vscode
16-
*.sh
26+
.vscode

.github/workflows/docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818

1919
- name: Get vars
2020
id: vars
@@ -24,17 +24,17 @@ jobs:
2424
echo "BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
2525
2626
- name: Set up Docker Buildx
27-
uses: docker/setup-buildx-action@v3
27+
uses: docker/setup-buildx-action@v4
2828

2929
- name: Login to GitHub Container Registry
30-
uses: docker/login-action@v3
30+
uses: docker/login-action@v4
3131
with:
3232
registry: ghcr.io
3333
username: ${{ github.actor }}
3434
password: ${{ secrets.GITHUB_TOKEN }}
3535

3636
- name: Build and push
37-
uses: docker/build-push-action@v5
37+
uses: docker/build-push-action@v7
3838
with:
3939
context: . # Dockerfile 所在的上下文路径
4040
push: true # 是否推送

.github/workflows/go.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
- "docs/**"
1515
- "examples/**"
1616
- "scripts/**"
17+
- ".dockerignore"
18+
- "Dockerfile"
19+
- "docker-compose.yml"
1720
pull_request:
1821
branches: [ "dev" ]
1922
paths-ignore:
@@ -24,6 +27,9 @@ on:
2427
- "docs/**"
2528
- "examples/**"
2629
- "scripts/**"
30+
- ".dockerignore"
31+
- "Dockerfile"
32+
- "docker-compose.yml"
2733

2834
permissions:
2935
contents: write
@@ -35,12 +41,12 @@ jobs:
3541
runs-on: ubuntu-latest
3642
steps:
3743
- name: Checkout
38-
uses: actions/checkout@v4
44+
uses: actions/checkout@v6
3945
with:
4046
fetch-depth: 0
4147

4248
- name: Set up Go
43-
uses: actions/setup-go@v5
49+
uses: actions/setup-go@v6
4450
with:
4551
go-version: "1.25.0"
4652

@@ -70,7 +76,7 @@ jobs:
7076
echo "DEV_TAG=${DEV_TAG}" >> $GITHUB_ENV
7177
7278
- name: Run GoReleaser
73-
uses: goreleaser/goreleaser-action@v6
79+
uses: goreleaser/goreleaser-action@v7
7480
with:
7581
distribution: goreleaser
7682
version: "~> v2"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1818
with:
1919
fetch-depth: 0
2020

2121
- name: Set up Go
22-
uses: actions/setup-go@v5
22+
uses: actions/setup-go@v6
2323
with:
2424
go-version: "1.25.0"
2525

2626
- name: Run GoReleaser
27-
uses: goreleaser/goreleaser-action@v6
27+
uses: goreleaser/goreleaser-action@v7
2828
with:
2929
distribution: goreleaser
3030
version: "~> v2"

.gitignore

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
# Ignore build artifacts and database files
12
sticker_go
23
sticker_go*
4+
dist/
5+
*.exe
6+
*.old
7+
8+
# Ignore local development files
39
cache/
410
logs/
5-
.vscode/
6-
sticker_go.db
11+
data/
12+
13+
# Ignore local configuration files
714
config.yaml
8-
*.exe
9-
*.old
15+
16+
# Ignore local test files
1017
*.txt
11-
*.sh
12-
data/
13-
dist/
18+
19+
# Ignore editor and IDE files
20+
.vscode/

.goreleaser.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ builds:
1515
- amd64
1616
- arm64
1717
main: ./main.go
18-
ldflags: "-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL \"dev\" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }} -X github.com/libost/sticker_go/version.BuildTime={{.Date}} -X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}} -X github.com/libost/sticker_go/version.Branch={{.Branch}}"
18+
ldflags: |
19+
-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL "dev" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
20+
-X github.com/libost/sticker_go/version.BuildTime={{.Date}}
21+
-X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}}
22+
-X github.com/libost/sticker_go/version.Branch={{.Branch}}
23+
{{ if eq .Env.RELEASE_CHANNEL "stable" }}-s -w{{ end }}
1924
binary: sticker_go
2025

2126
- id: windows
@@ -27,7 +32,12 @@ builds:
2732
- amd64
2833
- arm64
2934
main: ./main.go
30-
ldflags: "-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL \"dev\" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }} -X github.com/libost/sticker_go/version.BuildTime={{.Date}} -X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}} -X github.com/libost/sticker_go/version.Branch={{.Branch}}"
35+
ldflags: |
36+
-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL "dev" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
37+
-X github.com/libost/sticker_go/version.BuildTime={{.Date}}
38+
-X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}}
39+
-X github.com/libost/sticker_go/version.Branch={{.Branch}}
40+
{{ if eq .Env.RELEASE_CHANNEL "stable" }}-s -w{{ end }}
3141
binary: sticker_go
3242

3343
- id: macos
@@ -39,7 +49,12 @@ builds:
3949
- amd64
4050
- arm64
4151
main: ./main.go
42-
ldflags: "-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL \"dev\" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }} -X github.com/libost/sticker_go/version.BuildTime={{.Date}} -X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}} -X github.com/libost/sticker_go/version.Branch={{.Branch}}"
52+
ldflags: |
53+
-X github.com/libost/sticker_go/version.Version={{ if eq .Env.RELEASE_CHANNEL "dev" }}{{ .ShortCommit }}{{ else }}{{ .Version }}{{ end }}
54+
-X github.com/libost/sticker_go/version.BuildTime={{.Date}}
55+
-X github.com/libost/sticker_go/version.GitCommit={{.ShortCommit}}
56+
-X github.com/libost/sticker_go/version.Branch={{.Branch}}
57+
{{ if eq .Env.RELEASE_CHANNEL "stable" }}-s -w{{ end }}
4358
binary: sticker_go
4459

4560
archives:
@@ -101,6 +116,8 @@ announce:
101116
enabled: true
102117
chat_id: "@BangDream0114"
103118
message_template: |
119+
\#{{ .ProjectName | mdv2escape }} {{ if eq .Env.RELEASE_CHANNEL "dev" }}测试版{{ else }}新版本{{ end }}信息
120+
104121
{{ if eq .Env.RELEASE_CHANNEL "dev" }}🚀 {{ .ProjectName | mdv2escape }} 新测试版发行: {{ .ShortCommit | mdv2escape }}{{ else }}🎉 {{ .ProjectName | mdv2escape }} 新版本发行: {{ .Tag | mdv2escape }}{{ end }}
105122
106123
[有问题点我反馈]({{ .Env.FEEDBACK | mdv2escape }})

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG GIT_COMMIT
66
ARG BRANCH
77
WORKDIR /src
88
COPY . .
9-
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-X github.com/libost/sticker_go/version.Version=${VERSION} -X github.com/libost/sticker_go/version.Branch=${BRANCH} -X github.com/libost/sticker_go/version.GitCommit=${GIT_COMMIT} -X github.com/libost/sticker_go/version.BuildTime=${BUILD_TIME}" -o /out/sticker_go .
9+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-X github.com/libost/sticker_go/version.Version=${VERSION} -X github.com/libost/sticker_go/version.Branch=${BRANCH} -X github.com/libost/sticker_go/version.GitCommit=${GIT_COMMIT} -X github.com/libost/sticker_go/version.BuildTime=${BUILD_TIME} -s -w" -o /out/sticker_go .
1010

1111
FROM alpine:3.21
1212

build.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
2+
Write-Error "Go is not installed or not in PATH. Please install Go and try again."
3+
exit 1
4+
}
5+
$DateStamp = Get-Date -Format "s"
6+
$Version = "InDev"
7+
go build -o sticker_go.exe -ldflags "-X github.com/libost/sticker_go/version.Version=$Version -X github.com/libost/sticker_go/version.BuildTime=$DateStamp" main.go
8+
Write-Output "Build completed: sticker_go.exe (Version: $Version, Build Time: $DateStamp)"

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
if ! command -v go &> /dev/null
3+
then
4+
echo "Go is not installed or not in PATH. Please install Go and try again."
5+
exit 1
6+
fi
7+
DateStamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
8+
Version="InDev"
9+
go build -o sticker_go -ldflags "-X github.com/libost/sticker_go/version.Version=$Version -X github.com/libost/sticker_go/version.BuildTime=$DateStamp" main.go
10+
echo "Build completed: sticker_go (Version: $Version, Build Time: $DateStamp)"

buildrun.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
2+
Write-Error "Go is not installed or not in PATH. Please install Go and try again."
3+
exit 1
4+
}
5+
$DateStamp = Get-Date -Format "s"
6+
$Version = "InDev"
7+
go build -o sticker_go.exe -ldflags "-X github.com/libost/sticker_go/version.Version=$Version -X github.com/libost/sticker_go/version.BuildTime=$DateStamp -s -w" main.go
8+
Write-Output "Build completed: sticker_go.exe (Version: $Version, Build Time: $DateStamp)"
9+
./sticker_go.exe

0 commit comments

Comments
 (0)