Skip to content

Commit 4d94de3

Browse files
committed
chore: initialize diskcli (Quark pan CLI)
- Quark pan file ops: ls / cp / mv / rm / search, rename / mkdir - share: create, paged list, delete, and save (transfer) links - concurrent multipart upload with backoff/v5 exponential retry - TOML config with multi-account support (DISK_ACCOUNT env) - GitHub Pages landing page under docs/ Generated-by: hy3-ioa
0 parents  commit 4d94de3

52 files changed

Lines changed: 8641 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
attestations: write
14+
id-token: write
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v7
21+
- uses: actions/setup-go@v6
22+
with:
23+
go-version: '1.26'
24+
- run: go test -race -coverprofile=coverage.out ./...
25+
- run: go vet ./...
26+
27+
# Build inside the official golang:1.26 image (GitHub mounts the runner's
28+
# Node into the container, so JS actions like checkout/upload-artifact work).
29+
build:
30+
runs-on: ubuntu-latest
31+
container: golang:1.26
32+
needs: [test]
33+
steps:
34+
- uses: actions/checkout@v7
35+
- id: date
36+
run: echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
37+
- name: Build (inject version metadata)
38+
env:
39+
VERSION: ${{ github.ref_name }}
40+
COMMIT: ${{ github.sha }}
41+
DATE: ${{ steps.date.outputs.date }}
42+
CGO_ENABLED: "0"
43+
run: |
44+
go build -trimpath \
45+
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" \
46+
-o diskcli ./cmd/diskcli
47+
48+
# Cross-compile release binaries for every OS/CPU combo on tag pushes.
49+
release:
50+
if: startsWith(github.ref, 'refs/tags/v')
51+
needs: [test]
52+
runs-on: ubuntu-latest
53+
container: golang:1.26
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- { goos: linux, goarch: amd64 }
59+
- { goos: linux, goarch: arm64 }
60+
- { goos: linux, goarch: arm }
61+
- { goos: darwin, goarch: amd64 }
62+
- { goos: darwin, goarch: arm64 }
63+
- { goos: windows, goarch: amd64 }
64+
- { goos: windows, goarch: arm64 }
65+
steps:
66+
- uses: actions/checkout@v7
67+
- id: date
68+
run: echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
69+
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
70+
env:
71+
GOOS: ${{ matrix.goos }}
72+
GOARCH: ${{ matrix.goarch }}
73+
VERSION: ${{ github.ref_name }}
74+
COMMIT: ${{ github.sha }}
75+
DATE: ${{ steps.date.outputs.date }}
76+
CGO_ENABLED: "0"
77+
run: |
78+
EXT=""
79+
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; fi
80+
go build -trimpath \
81+
-ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" \
82+
-o "dist/diskcli-${GOOS}-${GOARCH}${EXT}" ./cmd/diskcli
83+
- uses: actions/upload-artifact@v7
84+
with:
85+
name: diskcli-${{ matrix.goos }}-${{ matrix.goarch }}
86+
path: dist/diskcli-${{ matrix.goos }}-${{ matrix.goarch }}*
87+
if-no-files-found: error
88+
89+
# Collect all binaries, generate sha256 checksums, and publish the release.
90+
publish:
91+
if: startsWith(github.ref, 'refs/tags/v')
92+
needs: [release]
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/download-artifact@v8
96+
with:
97+
path: dist
98+
merge-multiple: true
99+
- name: Generate checksums
100+
working-directory: dist
101+
run: sha256sum * > checksums.txt
102+
- uses: softprops/action-gh-release@v3
103+
with:
104+
files: dist/*
105+
generate_release_notes: true
106+
107+
docker:
108+
if: startsWith(github.ref, 'refs/tags/v')
109+
needs: [build]
110+
runs-on: ubuntu-latest
111+
steps:
112+
- uses: actions/checkout@v7
113+
- uses: docker/setup-qemu-action@v4
114+
- uses: docker/setup-buildx-action@v4
115+
- uses: docker/login-action@v4
116+
with:
117+
registry: ghcr.io
118+
username: ${{ github.actor }}
119+
password: ${{ secrets.GITHUB_TOKEN }}
120+
- uses: docker/metadata-action@v6
121+
id: meta
122+
with:
123+
images: ghcr.io/${{ github.repository }}
124+
tags: |
125+
type=semver,pattern={{version}}
126+
type=semver,pattern={{major}}.{{minor}}
127+
type=sha,prefix=
128+
- uses: docker/build-push-action@v7
129+
with:
130+
context: .
131+
platforms: linux/amd64,linux/arm64
132+
push: true
133+
tags: ${{ steps.meta.outputs.tags }}
134+
labels: ${{ steps.meta.outputs.labels }}

‎.gitignore‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 构建产物
2+
/diskcli
3+
/dist/
4+
/bin/
5+
6+
# 测试覆盖率
7+
*.out
8+
coverage.txt
9+
10+
# IDE
11+
.vscode/
12+
.idea/
13+
*.swp
14+
*.swo
15+
16+
# OS
17+
.DS_Store
18+
Thumbs.db
19+
20+
# 本地配置(cookie 含敏感信息)
21+
.qkconfig
22+
.diskconfig
23+
.env
24+
25+
# 上传断点续传状态
26+
.qkcli/
27+
.diskcli/

‎Dockerfile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ---- Build stage ----
2+
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
3+
4+
ARG TARGETOS
5+
ARG TARGETARCH
6+
ARG VERSION=dev
7+
ARG COMMIT=unknown
8+
9+
WORKDIR /src
10+
COPY go.mod go.sum ./
11+
RUN go mod download
12+
COPY . .
13+
14+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
15+
go build -trimpath -ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT}" \
16+
-o /out/diskcli ./cmd/diskcli
17+
18+
# ---- Runtime stage ----
19+
FROM gcr.io/distroless/static-debian12:nonroot
20+
21+
COPY --from=builder /out/diskcli /usr/bin/diskcli
22+
23+
ENTRYPOINT ["diskcli"]

0 commit comments

Comments
 (0)