Remove Docker and non-Windows builds from release process

This commit updates the GitHub Actions workflow, GoReleaser config, and Makefile to only build and release Windows/amd64 binaries. Docker image builds, multi-arch support, and related configuration have been removed to simplify the release process and focus on Windows releases.
This commit is contained in:
lx1056758714-glitch
2025-12-18 21:52:28 +08:00
parent 428dabe05a
commit f577b3956d
3 changed files with 7 additions and 212 deletions

View File

@@ -1,145 +1,53 @@
name: Release
on:
push:
tags:
- 'v*'
branches:
- main
env:
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
name: Release Binary and Docker
name: Release Binary
runs-on: ubuntu-latest
container:
image: goreleaser/goreleaser-cross:v1.24
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix git permissions
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser (Release)
if: startsWith(github.ref, 'refs/tags/')
run: goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser (Snapshot)
if: "!startsWith(github.ref, 'refs/tags/')"
run: goreleaser build --snapshot --clean
- name: Upload Artifacts
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v4
with:
name: chatlog-snapshot
path: dist/chatlog_windows_amd64_v1/chatlog.exe
path: dist/chatlog_windows_amd64_v1/chatlog.exe

View File

@@ -13,68 +13,32 @@ builds:
env:
- CGO_ENABLED=1
goos:
- darwin
- windows
- linux
goarch:
- amd64
- arm64
overrides:
- goos: darwin
goarch: amd64
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
- goos: darwin
goarch: arm64
env:
- CGO_ENABLED=1
- CC=oa64-clang
- CXX=oa64-clang++
- goos: windows
goarch: amd64
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
- goos: windows
goarch: arm64
env:
- CGO_ENABLED=1
- CC=/llvm-mingw/bin/aarch64-w64-mingw32-gcc
- CXX=/llvm-mingw/bin/aarch64-w64-mingw32-g++
- goos: linux
goarch: amd64
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- goos: linux
goarch: arm64
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
upx:
- enabled: true
goos: [darwin, windows, linux]
goarch: [amd64, arm64]
goos: [windows]
goarch: [amd64]
compress: best
lzma: true
archives:
- id: default
formats: tar.gz
formats: zip
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- .Arch }}
format_overrides:
- goos: windows
formats: zip
files:
- LICENSE
- README.md
@@ -87,73 +51,4 @@ checksum:
release:
draft: false
prerelease: auto
mode: replace
# Docker 镜像配置
# FIXME: 等待 goreleaser 2.12 更新后使用 dockers_v2
dockers:
- image_templates:
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
- "sjzar/chatlog:{{ .Tag }}-amd64"
dockerfile: Dockerfile
extra_files:
- script/docker-entrypoint.sh
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.description=chat log tool, easily use your own chat data."
- "--label=org.opencontainers.image.url=https://github.com/sjzar/chatlog"
- "--label=org.opencontainers.image.source=https://github.com/sjzar/chatlog"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
- image_templates:
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
- "sjzar/chatlog:{{ .Tag }}-arm64"
dockerfile: Dockerfile
extra_files:
- script/docker-entrypoint.sh
use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.description=chat log tool, easily use your own chat data."
- "--label=org.opencontainers.image.url=https://github.com/sjzar/chatlog"
- "--label=org.opencontainers.image.source=https://github.com/sjzar/chatlog"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
# Docker manifest 配置用于多架构镜像
docker_manifests:
# GitHub Container Registry manifests
- name_template: "ghcr.io/sjzar/chatlog:{{ .Tag }}"
image_templates:
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
# Docker Hub manifests
- name_template: "sjzar/chatlog:{{ .Tag }}"
image_templates:
- "sjzar/chatlog:{{ .Tag }}-amd64"
- "sjzar/chatlog:{{ .Tag }}-arm64"
# GitHub Container Registry latest
- name_template: "{{ if not .Prerelease }}ghcr.io/sjzar/chatlog:latest{{ end }}"
image_templates:
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-amd64"
- "ghcr.io/sjzar/chatlog:{{ .Tag }}-arm64"
# Docker Hub latest
- name_template: "{{ if not .Prerelease }}sjzar/chatlog:latest{{ end }}"
image_templates:
- "sjzar/chatlog:{{ .Tag }}-amd64"
- "sjzar/chatlog:{{ .Tag }}-arm64"
mode: replace

View File

@@ -6,17 +6,9 @@ endif
LDFLAGS := -ldflags '-X "github.com/sjzar/chatlog/pkg/version.Version=$(VERSION)" -w -s'
PLATFORMS := \
darwin/amd64 \
darwin/arm64 \
linux/amd64 \
linux/arm64 \
windows/amd64 \
windows/arm64
windows/amd64
UPX_PLATFORMS := \
darwin/amd64 \
linux/amd64 \
linux/arm64 \
windows/amd64
.PHONY: all clean lint tidy test build crossbuild upx