Skip to content

Commit

Permalink
fix: goreleaser config
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 14, 2023
1 parent 5c28423 commit d95b6d5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 7 deletions.
43 changes: 36 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ before:
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
project_name: bot
builds:
- env:
- CGO_ENABLED=0
Expand All @@ -24,13 +25,13 @@ builds:
ldflags:
- -X 'github.com/hitokoto-osc/telegram_bot/build.Version={{.Version}}' -X 'github.com/hitokoto-osc/telegram_bot/build.CommitTag={{.FullCommit}}' -X 'github.com/hitokoto-osc/telegram_bot/build.CommitTime={{ .CommitDate }}'
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- name_template: >-
{{- .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end -}}
format_overrides:
- goos: windows
format: zip
Expand All @@ -47,3 +48,31 @@ changelog:
exclude:
- '^docs:'
- '^test:'

dockers:
- goos: linux
# GOARCH of the built binaries/packages that should be used.
goarch: amd64
# GOARM of the built binaries/packages that should be used.
goarm: ''
image_templates:
- "hitokoto/telegram-bot:latest"
- "hitokoto/telegram-bot:{{ .Tag }}"
- "hitokoto/telegram-bot:v{{ .Major }}"
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/hitokoto-osc/telegram_bot/master/README.md"
- "--label=io.artifacthub.package.logo-url=https://cdn.a632079.me/assets/images/hitokoto-logo-512x512.png"
- '--label=io.artifacthub.package.maintainers=[{"name":"a632079","email":"[email protected]"}]'
- "--label=io.artifacthub.package.license=MIT"
- "--label=org.opencontainers.image.description=一言的 Telegram 机器人程序"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
extra_files:
- config.example.yml
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.18
ENV TZ Asia/Shanghai
RUN apk add alpine-conf tzdata && \
/sbin/setup-timezone -z Asia/Shanghai && \
apk del alpine-conf

ENV WORKDIR /app
VOLUME $WORKDIR/data
COPY config.example.yml $WORKDIR/data/config.example.yml
COPY bot $WORKDIR/
WORKDIR $WORKDIR

ENTRYPOINT ["./bot", "start"]

0 comments on commit d95b6d5

Please sign in to comment.