diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index d77a505..34b41d7 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -30,11 +30,9 @@ jobs: MINOR_VERSION=${BASH_REMATCH[2]} PATCH_VERSION=${BASH_REMATCH[3]} - # 检查是否满足创建分支的条件 if [[ ${PATCH_VERSION} -eq 0 && ! ${TAG_NAME} =~ [A-Za-z-] ]]; then RELEASE_BRANCH_NAME="release-v${MAJOR_VERSION}.0" - # 创建分支 git branch "${RELEASE_BRANCH_NAME}" "${TAG_NAME}" git push origin "${RELEASE_BRANCH_NAME}" diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b262ea0..6947a96 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -28,25 +28,9 @@ report_sizes: true dist: _output/dist builds: - - binary: syncer - id: syncer - main: ./cmd/syncer/main.go - goos: - - windows - - darwin - - linux - - freebsd - goarch: - - amd64 - - 386 - - arm - - arm64 - goarm: - - 6 - - 7 - - binary: exporter - id: exporter - main: ./cmd/exporter/main.go + - binary: cld + id: cld + main: ./cmd/cld/main.go goos: - windows - darwin @@ -192,26 +176,13 @@ changelog: kos: - - repository: ghcr.io/kubecub/syncer - id: syncer - tags: - - '{{.Version}}' - - latest - bare: true - main: ./cmd/syncer/main.go - preserve_import_paths: false - base_image: alpine - platforms: - - linux/amd64 - - linux/arm64 - - - repository: ghcr.io/kubecub/exporter - id: exporter + - repository: ghcr.io/kubecub/cld + id: cld tags: - '{{.Version}}' - latest bare: true - main: ./cmd/exporter/main.go + main: ./cmd/cld/main.go base_image: alpine preserve_import_paths: false platforms: @@ -293,53 +264,53 @@ checksum: # - use: buildx # ids: -# - exporter +# - cld # goos: linux # goarch: amd64 # image_templates: -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64 -# dockerfile: deploy/exporter/Dockerfile.exporter +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64 +# dockerfile: deploy/cld/Dockerfile.cld # build_flag_templates: # - --pull # - --platform=linux/amd64 -# - --label=io.exporter.image.created={{.Date}} -# - --label=io.exporter.image.title=exporter -# - --label=io.exporter.image.revision={{.ShortCommit}} -# - --label=io.exporter.image.version={{.Tag }} -# - --label=io.exporter.image.auth={{ .Env.USERNAME }} +# - --label=io.cld.image.created={{.Date}} +# - --label=io.cld.image.title=cld +# - --label=io.cld.image.revision={{.ShortCommit}} +# - --label=io.cld.image.version={{.Tag }} +# - --label=io.cld.image.auth={{ .Env.USERNAME }} # - use: buildx # ids: -# - exporter +# - cld # goos: linux # goarch: arm64 # image_templates: -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64 -# dockerfile: docker/exporter/Dockerfile.exporter +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64 +# dockerfile: docker/cld/Dockerfile.cld # build_flag_templates: # - --pull # - --platform=linux/arm64 -# - --label=io.exporter.image.created={{.Date}} -# - --label=io.exporter.image.title=exporter -# - --label=io.exporter.image.revision={{.ShortCommit}} -# - --label=io.exporter.image.version={{.Tag }} -# - --label=io.exporter.image.auth={{ .Env.USERNAME }} +# - --label=io.cld.image.created={{.Date}} +# - --label=io.cld.image.title=cld +# - --label=io.cld.image.revision={{.ShortCommit}} +# - --label=io.cld.image.version={{.Tag }} +# - --label=io.cld.image.auth={{ .Env.USERNAME }} # docker_manifests: -# - name_template: ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }} +# - name_template: ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }} # image_templates: -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64 -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64 +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64 +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64 # - name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }} # image_templates: # - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64 # - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64 -# - name_template: ghcr.io/{{ .Env.USERNAME }}/exporter:latest +# - name_template: ghcr.io/{{ .Env.USERNAME }}/cld:latest # image_templates: -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64 -# - ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64 +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-amd64 +# - ghcr.io/{{ .Env.USERNAME }}/cld:{{ .Tag }}-arm64 # - name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:latest # image_templates: # - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a89535..660bde7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,7 +73,7 @@ - delete issue template ### Feat -- complete base exporter +- complete base cld - add labels standard - synchronous tag - partial optimization diff --git a/Dockerfile b/Dockerfile index a9445a2..e7c90ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,16 +2,22 @@ # Licensed under the MIT License (the "License"); # you may not use this file except in compliance with the License. -FROM golang AS build +FROM golang:1.20 as builder + +WORKDIR /build + ENV GOPROXY=https://goproxy.cn -WORKDIR /go/src/app -COPY . /go/src/app +COPY . . -# RUN go build -o /go/bin/app cmd/exporter/main.go RUN make build -FROM alpine -COPY --from=build /go/bin/app/_output / -CMD ["/app"] +FROM alpine:latest + +WORKDIR /app + +COPY --from=builder /build/_output/bin/platforms/linux/amd64/cld . +COPY --from=builder /build/config.yaml . + +ENTRYPOINT ["./cld", "-config", "config.yaml"] diff --git a/action.yml b/action.yml index 067e5d2..5c390a7 100644 --- a/action.yml +++ b/action.yml @@ -2,3 +2,20 @@ # Licensed under the MIT License (the "License"); # you may not use this file except in compliance with the License. +name: 'Code Language Detector' +description: 'Detects specified languages in comments within code files.' +inputs: + config-path: + description: 'Path to the configuration file.' + required: true + default: '.github/code-language-detector.yml' + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.config-path }} + +branding: + icon: tool + color: blue \ No newline at end of file diff --git a/deploy/OWNERS b/deploy/OWNERS new file mode 100644 index 0000000..a9521f7 --- /dev/null +++ b/deploy/OWNERS @@ -0,0 +1,4 @@ +reviewers: + - cubxxw +approvers: + - cubxxw \ No newline at end of file diff --git a/deploy/README.md b/deploy/README.md new file mode 100644 index 0000000..00bfce3 --- /dev/null +++ b/deploy/README.md @@ -0,0 +1,11 @@ +# `/build` + +Packaging and Continuous Integration. + +Put your cloud (AMI), container (Docker), OS (deb, rpm, pkg) package configurations and scripts in the `/build/package` directory. + +Put your CI (travis, circle, drone) configurations and scripts in the `/build/ci` directory. Note that some of the CI tools (e.g., Travis CI) are very picky about the location of their config files. Try putting the config files in the `/build/ci` directory linking them to the location where the CI tools expect them when possible (don't worry if it's not and if keeping those files in the root directory makes your life easier :-)). + +Examples: + +* https://github.com/cockroachdb/cockroach/tree/master/build \ No newline at end of file diff --git a/deploy/cld/Dockerfile.cld b/deploy/cld/Dockerfile.cld new file mode 100644 index 0000000..bbe96c3 --- /dev/null +++ b/deploy/cld/Dockerfile.cld @@ -0,0 +1,13 @@ +FROM golang AS builder + +WORKDIR /app + +ENV GOPROXY=https://goproxy.cn + +COPY . /app/ + +RUN cd /app; go build -o _output/bin/cld cmd/cld/main.go + +FROM scratch +COPY --from=builder /app/_output/bin/cld /app +ENTRYPOINT ["/app/cld --help"] \ No newline at end of file