From 88f6f51effea0c7f221586d6de660fa6ea4e7f2f Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Wed, 2 Aug 2023 12:35:45 +0800 Subject: [PATCH] feat: set github hub Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .github/dependabot.yml | 34 ++++++++++++ .github/workflows/auto-gh-pr.yml | 28 +++------- .golangci.yml | 2 +- .goreleaser.yaml | 9 ++- Dockerfile | 13 +---- docker-compose.yaml | 9 ++- scripts/style_info.sh | 95 ++++++++++++++++---------------- 7 files changed, 104 insertions(+), 86 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f6150ead7..f495b588f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,37 @@ updates: directory: "/" schedule: interval: "daily" + time: "08:00" + labels: + - "dependencies" + commit-message: + prefix: "feat" + include: "scope" + groups: + gomod-deps: + patterns: + - "*" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + time: "08:00" + labels: + - "dependencies" + commit-message: + prefix: "chore" + include: "scope" + groups: + github-actions: + patterns: + - "*" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "daily" + time: "08:00" + labels: + - "dependencies" + commit-message: + prefix: "feat" + include: "scope" \ No newline at end of file diff --git a/.github/workflows/auto-gh-pr.yml b/.github/workflows/auto-gh-pr.yml index 1d8c90d33..0913655ca 100644 --- a/.github/workflows/auto-gh-pr.yml +++ b/.github/workflows/auto-gh-pr.yml @@ -18,30 +18,21 @@ on: pull_request: # types: # - closed + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] jobs: create-pr: runs-on: ubuntu-latest - if: github.event.pull_request.base.ref == 'main' + if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true steps: - name: Check out code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup GitHub CLI - run: | - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 - sudo apt-add-repository https://cli.github.com/packages - sudo apt-get update - sudo apt-get install gh - continue-on-error: true - - # - name: Configure GitHub CLI - # run: | - # git config --global user.email "3293172751ysy@gmail.com" - # git config --global user.name "kubbot" - # echo "${{ secrets.BOT_GITHUB_TOKEN }}" | gh auth login --with-token - name: Create PR to release branch run: | ISSUEID=$(gh pr view ${{ github.event.pull_request.number }} --repo $OWNER/$REPO | grep -oP 'Fixes #\K\d+') @@ -56,10 +47,9 @@ jobs: gh pr edit ${{ github.event.pull_request.number }} --repo $OWNER/$REPO --add-label "$LABELS" --add-assignee "$ASSIGNEES" --milestone "$MILESTONE" - git checkout -b bot/merge-to-release-$ISSUEID - git push origin bot/merge-to-release-$ISSUEID - gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body "" - + # git checkout -b bot/merge-to-release-$ISSUEID + # git push origin bot/merge-to-release-$ISSUEID + # gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body "" # gh pr create --base main --head feat/auto-release-pr-624 --title "The bug is fixed" --body "$x" --repo OpenIMSDK/Open-IM-Server --reviewer "cubxxw" continue-on-error: true env: @@ -67,4 +57,4 @@ jobs: GH_TOKEN: ${{ github.token }} ISSUE: ${{ github.event.issue.html_url }} OWNER: ${{ github.repository_owner }} - REPO: ${{ github.event.repository.name }} \ No newline at end of file + REPO: ${{ github.event.repository.name }} diff --git a/.golangci.yml b/.golangci.yml index 296bd0dc0..8bafbbe5c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -114,7 +114,7 @@ linters-settings: max-blank-identifiers: 2 dupl: # tokens count to trigger issue, 150 by default - threshold: 100 + threshold: 200 errcheck: # report about not checking of errors in type assertions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 31cdbd085..bf7ef81f5 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -447,8 +447,8 @@ milestones: # Repository for the milestone # Default is extracted from the origin remote URL repo: - owner: user - name: repo + owner: OpenIMSDK + name: Open-IM-Server # Whether to close the milestone close: true @@ -479,6 +479,9 @@ checksum: algorithm: sha256 release: + + prerelease: auto + footer: | ## Welcome to the {{ .Tag }} release of [chat](https://github.com/OpenIMSDK/chat)!🎉🎉! @@ -493,7 +496,7 @@ release: This release is only possible thanks to **all** the support of some **awesome people**! - https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/version.md + If you wish to use mirroring, read OpenIM's [image management policy](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/docs/conversions/images.md) **Want to be one of them 😘?** diff --git a/Dockerfile b/Dockerfile index 85afdf98b..c9097e651 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,6 @@ # Build Stage FROM golang:1.20 AS builder -LABEL org.opencontainers.image.source=https://github.com/OpenIMSDK/Open-IM-Server -LABEL org.opencontainers.image.description="OpenIM Server image" -LABEL org.opencontainers.image.licenses="Apache 2.0" - # Set go mod installation source and proxy ARG GO111MODULE=on ARG GOPROXY=https://goproxy.cn,direct @@ -19,14 +15,7 @@ ADD . . RUN /bin/sh -c "make build" -# Production Stage -FROM alpine - -RUN echo "https://mirrors.aliyun.com/alpine/v3.4/main" > /etc/apk/repositories && \ - apk --no-cache add tzdata ca-certificates bash - -# Set directory to map logs, config files, scripts, and SDK -VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"] +FROM ghcr.io/openim-sigs/openim-bash-image:latest # Copy scripts and binary files to the production image COPY --from=builder /Open-IM-Server/scripts /Open-IM-Server/scripts diff --git a/docker-compose.yaml b/docker-compose.yaml index 394232df3..5b91294bb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -103,11 +103,10 @@ services: image: ghcr.io/openimsdk/openim-server:latest container_name: openim-server volumes: - - ./logs:/Open-IM-Server/logs - - ./config/config.yaml:/Open-IM-Server/config/config.yaml - - ./config/notification.yaml:/Open-IM-Server/config/notification.yaml - - ${DATA_DIR}/db/sdk:/Open-IM-Server/db/sdk - - ./scripts:/Open-IM-Server/scripts + - ./logs:/openim/openim-server/logs + - ./config/config.yaml:/openim/openim-server/config/config.yaml + - ./config/notification.yaml:/openim/openim-server/config/notification.yaml + - ./scripts:/openim/openim-server/scripts restart: always depends_on: - zookeeper diff --git a/scripts/style_info.sh b/scripts/style_info.sh index b56eceeff..ff3a6330b 100755 --- a/scripts/style_info.sh +++ b/scripts/style_info.sh @@ -13,50 +13,53 @@ # See the License for the specific language governing permissions and # limitations under the License. +function style-info() { + COLOR_SUFFIX="\033[0m" # End all colors and special effects -COLOR_SUFFIX="\033[0m" # End all colors and special effects - -BLACK_PREFIX="\033[30m" # Black prefix -RED_PREFIX="\033[31m" # Red prefix -GREEN_PREFIX="\033[32m" # Green prefix -YELLOW_PREFIX="\033[33m" # Yellow prefix -BLUE_PREFIX="\033[34m" # Blue prefix -PURPLE_PREFIX="\033[35m" # Purple prefix -SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix -WHITE_PREFIX="\033[37m" # White prefix -BOLD_PREFIX="\033[1m" # Bold prefix -UNDERLINE_PREFIX="\033[4m" # Underline prefix -ITALIC_PREFIX="\033[3m" # Italic prefix - -CYAN_PREFIX="033[0;36m" # Cyan prefix - -BACKGROUND_BLACK="\033[40m" # Black background -BACKGROUND_RED="\033[41m" # Red background -BACKGROUND_GREEN="\033[42m" # Green background -BACKGROUND_YELLOW="\033[43m" # Yellow background -BACKGROUND_BLUE="\033[44m" # Blue background -BACKGROUND_PURPLE="\033[45m" # Purple background -BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background -BACKGROUND_WHITE="\033[47m" # White background - -BLINK="\033[5m" # Blinking effect -INVERT="\033[7m" # Invert color -HIDE="\033[8m" # Hide text - -GRAY_PREFIX="\033[90m" # Gray prefix -LIGHT_RED_PREFIX="\033[91m" # Light red prefix -LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix -LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix -LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix -LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix -LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix -LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix - -BACKGROUND_GRAY="\033[100m" # Gray background -BACKGROUND_LIGHT_RED="\033[101m" # Light red background -BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background -BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background -BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background -BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background -BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background -BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background + BLACK_PREFIX="\033[30m" # Black prefix + RED_PREFIX="\033[31m" # Red prefix + GREEN_PREFIX="\033[32m" # Green prefix + YELLOW_PREFIX="\033[33m" # Yellow prefix + BLUE_PREFIX="\033[34m" # Blue prefix + PURPLE_PREFIX="\033[35m" # Purple prefix + SKY_BLUE_PREFIX="\033[36m" # Sky blue prefix + WHITE_PREFIX="\033[37m" # White prefix + BOLD_PREFIX="\033[1m" # Bold prefix + UNDERLINE_PREFIX="\033[4m" # Underline prefix + ITALIC_PREFIX="\033[3m" # Italic prefix + + CYAN_PREFIX="033[0;36m" # Cyan prefix + + BACKGROUND_BLACK="\033[40m" # Black background + BACKGROUND_RED="\033[41m" # Red background + BACKGROUND_GREEN="\033[42m" # Green background + BACKGROUND_YELLOW="\033[43m" # Yellow background + BACKGROUND_BLUE="\033[44m" # Blue background + BACKGROUND_PURPLE="\033[45m" # Purple background + BACKGROUND_SKY_BLUE="\033[46m" # Sky blue background + BACKGROUND_WHITE="\033[47m" # White background + + BLINK="\033[5m" # Blinking effect + INVERT="\033[7m" # Invert color + HIDE="\033[8m" # Hide text + + GRAY_PREFIX="\033[90m" # Gray prefix + LIGHT_RED_PREFIX="\033[91m" # Light red prefix + LIGHT_GREEN_PREFIX="\033[92m" # Light green prefix + LIGHT_YELLOW_PREFIX="\033[93m" # Light yellow prefix + LIGHT_BLUE_PREFIX="\033[94m" # Light blue prefix + LIGHT_PURPLE_PREFIX="\033[95m" # Light purple prefix + LIGHT_SKY_BLUE_PREFIX="\033[96m" # Light sky blue prefix + LIGHT_WHITE_PREFIX="\033[97m" # Light white prefix + + BACKGROUND_GRAY="\033[100m" # Gray background + BACKGROUND_LIGHT_RED="\033[101m" # Light red background + BACKGROUND_LIGHT_GREEN="\033[102m" # Light green background + BACKGROUND_LIGHT_YELLOW="\033[103m" # Light yellow background + BACKGROUND_LIGHT_BLUE="\033[104m" # Light blue background + BACKGROUND_LIGHT_PURPLE="\033[105m" # Light purple background + BACKGROUND_LIGHT_SKY_BLUE="\033[106m" # Light sky blue background + BACKGROUND_LIGHT_WHITE="\033[107m" # Light white background +} + +style-info \ No newline at end of file