diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..2062bfe9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: 问题交流 +about: 有任何问题,都可以在这里交流。 +title: "[问题] " +labels: ["question"] +--- + +# 问题交流 💬 + +有任何问题,都可以在这里交流哦~ + +## 问题是什么呢? 🤔 + +请详细地描述你遇到的问题,包括出现问题的环境和步骤,以及你已经尝试过的解决方法。 + +另外,如果你在解决问题时已经查看过其他 GitHub Issue,请务必在文本中说明并引用相关信息。 + +## 附加信息 📝 + +请提供以下信息以帮助我们更快地解决问题: + +- 输出日志,包括错误信息和堆栈跟踪 +- 相关的代码片段或文件 +- 你的操作系统、golang 版本等环境信息 + +谢谢你的反馈!🙏 diff --git a/.github/pull-request-template.md b/.github/pull-request-template.md new file mode 100644 index 00000000..88adbd98 --- /dev/null +++ b/.github/pull-request-template.md @@ -0,0 +1,6 @@ + + + +**填写PR内容:** + +- diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..14d38631 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,42 @@ +# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter +name-template: 'v$NEXT_PATCH_VERSION 🌈' +tag-template: 'v$NEXT_PATCH_VERSION' +version-template: $MAJOR.$MINOR.$PATCH +# Emoji reference: https://gitmoji.carloscuesta.me/ +categories: + - title: 🚀 Features + labels: + - 'feature' + - 'enhancement' + - 'kind/feature' + - title: 🚑️ Bug Fixes + labels: + - 'fix' + - 'bugfix' + - 'bug' + - 'regression' + - 'kind/bug' + - title: 📝 Documentation updates + labels: + - 'doc' + - 'documentation' + - 'kind/doc' + - title: 👷 Maintenance + labels: + - chore + - dependencies + - 'kind/chore' + - 'kind/dep' + - title: 🚦 Tests + labels: + - test + - tests +exclude-labels: + - reverted + - no-changelog + - skip-changelog + - invalid +change-template: '* $TITLE (#$NUMBER) @$AUTHOR' +template: | + ## What’s Changed + $CHANGES diff --git a/.github/workflows/release.yml b/.github/workflows/binary-release.yml similarity index 69% rename from .github/workflows/release.yml rename to .github/workflows/binary-release.yml index a047b49e..049d047d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/binary-release.yml @@ -2,11 +2,11 @@ name: Build Release on: release: - types: [created] - + types: [created,published] + permissions: contents: read - + jobs: build-go-binary: permissions: @@ -14,9 +14,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - goos: [linux, windows] - goarch: [amd64, arm64] - exclude: + goos: [ linux, windows, darwin ] # 需要打包的系统 + goarch: [ amd64, arm64 ] # 需要打包的架构 + exclude: # 排除某些平台和架构 - goarch: arm64 goos: windows steps: @@ -27,7 +27,7 @@ jobs: - name: Parallel build uses: wangyoucao577/go-release-action@v1.30 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: ${{ matrix.goarch }} goversion: 1.18 @@ -35,5 +35,5 @@ jobs: executable_compression: "upx -9" md5sum: false project_path: "./code" - binary_name: "start-feishubot" - extra_files: ./code/config.example.yaml + binary_name: "feishu-chatgpt" + extra_files: ./code/config.example.yaml readme.md diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7174c938..f4b27004 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,47 +1,59 @@ -name: Docker Publish +name: build docker image +# 仅在release时触发 on: push: branches: - master - -env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + release: + types: [created,published] + + # 可以手动触发 + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + tags: + description: 'Test scenario tags' jobs: - build-and-publish: + buildx: runs-on: ubuntu-latest - strategy: - matrix: - architecture: [ amd64, arm64 ] - steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v2 - - name: Login to Docker Hub + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ env.DOCKER_USERNAME }} - password: ${{ env.DOCKER_PASSWORD }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Set up Go - uses: actions/setup-go@v2 + - name: Build and push + uses: docker/build-push-action@v2 with: - go-version: '1.18' - - - name: Install dependencies - run: - cd ./code && go mod tidy - - - name: Build Docker image - run: | - docker build -t feishu-chatgpt:${{ matrix.architecture }}-${{ github.sha }} --build-arg ARCHITECTURE=${{ matrix.architecture }} . - - - name: Push Docker image to Docker Hub - run: | - docker tag feishu-chatgpt:${{ matrix.architecture }}-${{ github.sha }} ${{ env.DOCKER_USERNAME }}/feishu-chatgpt:${{ matrix.architecture }}-${{ github.sha }} - docker tag feishu-chatgpt:${{ matrix.architecture }}-${{ github.sha }} ${{ env.DOCKER_USERNAME }}/feishu-chatgpt:${{ matrix.architecture }}-latest - docker push ${{ env.DOCKER_USERNAME }}/feishu-chatgpt:${{ matrix.architecture }}-${{ github.sha }} - docker push ${{ env.DOCKER_USERNAME }}/feishu-chatgpt:${{ matrix.architecture }}-latest + context: . + file: ./Dockerfile + # 所需要的体系结构,可以在 Available platforms 步骤中获取所有的可用架构 + platforms: linux/amd64,linux/arm64/v8 + # 镜像推送时间 + push: ${{ github.event_name != 'pull_request' }} + # 给清单打上多个标签 + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.GITHUB_REPOSITORY_NAME_PART }}:${{ env.GITHUB_REF_NAME }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.GITHUB_REPOSITORY_NAME_PART }}:latest diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml new file mode 100644 index 00000000..94b21c7d --- /dev/null +++ b/.github/workflows/release-draft.yml @@ -0,0 +1,38 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + # pull_request_target: + # types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write # for release-drafter/release-drafter to create a github release + pull-requests: write # for release-drafter/release-drafter to add label to PR + runs-on: ubuntu-latest + steps: + # (Optional) GitHub Enterprise requires GHE_HOST variable set + #- name: Set GHE_HOST + # run: | + # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # with: + # config-name: my-config.yml + # disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/readme.md b/readme.md index d8670647..9603735c 100644 --- a/readme.md +++ b/readme.md @@ -133,13 +133,11 @@ docker run -d --restart=always --name feishu-chatgpt2 -p 9000:9000 -v /etc/local --env APP_VERIFICATION_TOKEN=xxx \ --env BOT_NAME=chatGpt \ --env OPENAI_KEY=sk-xxx \ -leizhenpeng/feishu-chatgpt:amd64-latest - -//如果mac替换为 -//leizhenpeng/feishu-chatgpt:arm64-latest +dockerproxy.com/leizhenpeng/feishu-chatgpt:latest ``` -事件回调地址是: http://IP:9000/webhook/event -卡片回调地址是: http://IP:9000/webhook/card + +事件回调地址: http://IP:9000/webhook/event +卡片回调地址: http://IP:9000/webhook/card 把它填入飞书后台
diff --git a/s.yaml b/s.yaml index 279d9432..8e45aca0 100644 --- a/s.yaml +++ b/s.yaml @@ -1,9 +1,9 @@ edition: 1.0.0 -name: hello-world-app +name: feishuBot-chatGpt access: "aliyun" # 秘钥别名 vars: # 全局变量 - region: "cn-hangzhou" + region: "cn-hongkong" services: helloworld: