feat: add go relase

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/695/head
Xinwei Xiong(cubxxw-openim) 1 year ago
parent 340ce42b17
commit 5eb97766b6
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -18,6 +18,7 @@ on:
push: push:
branches: branches:
- main - main
- release-*
tags: tags:
- v* - v*
workflow_dispatch: workflow_dispatch:
@ -29,6 +30,10 @@ jobs:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Build OpenIM Server
run: |
sudo make build
# docker.io/openim/openim-server:latest # docker.io/openim/openim-server:latest
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
@ -41,13 +46,12 @@ jobs:
uses: docker/metadata-action@v4.6.0 uses: docker/metadata-action@v4.6.0
with: with:
images: openim/openim-server images: openim/openim-server
tags: latest
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@ -64,15 +68,14 @@ jobs:
uses: docker/metadata-action@v4.6.0 uses: docker/metadata-action@v4.6.0
with: with:
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
tags: latest
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# ghcr.io/openim/openim-server:latest # ghcr.io/openim/openim-server:latest
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
@ -87,15 +90,14 @@ jobs:
uses: docker/metadata-action@v4.6.0 uses: docker/metadata-action@v4.6.0
with: with:
images: openim/openim-server images: openim/openim-server
tags: latest
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta3.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# name: OpenIM Build Docker Images # name: OpenIM Build Docker Images
# on: # on:

@ -18,6 +18,7 @@ on:
push: push:
branches: branches:
- 'devops' # Only for the dev branch - 'devops' # Only for the dev branch
- 'main'
paths: paths:
- '.github/workflows/*' - '.github/workflows/*'
# - '__test__/**' # dev No immediate testing is required # - '__test__/**' # dev No immediate testing is required
@ -30,36 +31,43 @@ jobs:
deploy-dev: deploy-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: set ssh key # Temporarily set up ssh key
run: |
mkdir -p ~/.ssh/
# secrets.WFP_ID_RSA set in GitHub
echo "${{secrets.WFP_ID_RSA}}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan "182.92.xxx.xxx" >> ~/.ssh/known_hosts
- name: executing remote ssh commands using password - name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.0 uses: appleboy/ssh-action@v1.0.0
env:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
with: with:
host: ${{ secrets.HOST }} host: "${{ secrets.SG_M1_HOST }}, ${{ secrets.SG_N1_HOST }}, ${{ secrets.SG_N2_HOST}}"
username: ${{ secrets.USERNAME }} username: ${{ secrets.SG_USERNAME }}
password: ${{ secrets.PASSWORD }} password: ${{ secrets.SG_PASSWORD }}
port: ${{ secrets.PORT }} port: ${{ secrets.SG_PORT }}
script: whoami envs: OWNER,REPO
- name: deploy # Deployment script_stop: true
run: | script: |
ssh work@182.92.xxx.xxx " mkdir -p /test/openim
# 【Attention】Log in with the 'work' account, manually create /home/work/imooc-lego directory cd /test/openim
# Then git clone https://username:password@github.com/imooc-lego/biz-editor-server.git -b dev (private repository, use GitHub username and password) pwd;ls -al
# Remember to delete origin to avoid exposing GitHub password echo "OWNER: $OWNER"
cd /home/work/imooc-lego/biz-editor-server; echo "REPO: $REPO"
git remote add origin https://openimbot:${{secrets.WFP_PASSWORD}}@github.com/OpenIMSDK/open-im-server.git; git clone -b develop https://github.com/${OWNER}/${REPO}.git; cd ${REPO}
git checkout dev; docker compose up -d
git pull origin dev; # Download the latest code again
git remote remove origin; # Remove origin to avoid exposing GitHub password
# Start docker # - name: deploy # Deployment
docker-compose build editor-server; # Same as the service name in docker-compose.yml # run: |
docker-compose up -d; # ssh work@182.92.xxx.xxx "
" # # 【Attention】Log in with the 'work' account, manually create /home/work/imooc-lego directory
- name: delete ssh key # Delete ssh key # # Then git clone https://username:password@github.com/imooc-lego/biz-editor-server.git -b dev (private repository, use GitHub username and password)
run: rm -rf ~/.ssh/id_rsa # # Remember to delete origin to avoid exposing GitHub password
# cd /home/work/imooc-lego/biz-editor-server;
# git remote add origin https://openimbot:${{secrets.WFP_PASSWORD}}@github.com/OpenIMSDK/open-im-server.git;
# git checkout dev;
# git pull origin dev; # Download the latest code again
# git remote remove origin; # Remove origin to avoid exposing GitHub password
# # Start docker
# docker-compose build editor-server; # Same as the service name in docker-compose.yml
# docker-compose up -d;
# "
# - name: delete ssh key # Delete ssh key
# run: rm -rf ~/.ssh/id_rsa

@ -0,0 +1,69 @@
# OpenIM Image Management Strategy and Pulling Guide
OpenIM is an efficient, stable, and scalable instant messaging framework that provides convenient deployment methods through Docker images. OpenIM manages multiple image sources, hosted respectively on GitHub (ghcr), Alibaba Cloud, and Docker Hub. This document is aimed at detailing the image management strategy of OpenIM and providing the steps for pulling these images.
## Image Management Strategy
OpenIM's versions correspond to GitHub's tag versions. Each time we release a new version and tag it on GitHub, an automated process is triggered that pushes the new Docker image version to the following three platforms:
1. **GitHub (ghcr.io):** We use GitHub Container Registry (ghcr.io) to host OpenIM's Docker images. This allows us to better integrate with the GitHub source code repository, providing better version control and continuous integration/deployment (CI/CD) features. You can view all GitHub images [here](https://github.com/orgs/OpenIMSDK/packages).
2. **Alibaba Cloud (registry.cn-hangzhou.aliyuncs.com):** For users in Mainland China, we also host OpenIM's Docker images on Alibaba Cloud to provide faster pull speeds. You can view all Alibaba Cloud images on this [page](https://cr.console.aliyun.com/cn-hangzhou/instances/repositories) of Alibaba Cloud Image Service (note that you need to log in to your Alibaba Cloud account first).
3. **Docker Hub (docker.io):** Docker Hub is the most commonly used Docker image hosting platform, and we also host OpenIM's images there to facilitate developers worldwide. You can view all Docker Hub images on the [OpenIM's Docker Hub page](https://hub.docker.com/r/openim).
## Methods and Steps for Pulling Images
When pulling OpenIM's Docker images, you can choose the most suitable source based on your geographic location and network conditions. Here are the steps to pull OpenIM images from each source:
1. First, make sure Docker is installed on your machine. If not, you can refer to the [Docker official documentation](https://docs.docker.com/get-docker/) for installation.
2. Open the terminal and run the following commands to pull the images:
For OpenIM Server:
- Pull from GitHub:
```
bashCopy code
docker pull ghcr.io/openim/openim-server:latest
```
- Pull from Alibaba Cloud:
```
bashCopy code
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server:latest
```
- Pull from Docker Hub:
```
bashCopy code
docker pull docker.io/openim/openim-server:latest
```
For OpenIM Chat:
- Pull from GitHub:
```
bashCopy code
docker pull ghcr.io/openim/openim-chat:latest
```
- Pull from Alibaba Cloud:
```
bashCopy code
docker pull registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-chat:latest
```
- Pull from Docker Hub:
```
bashCopy code
docker pull docker.io/openim/openim-chat:latest
```
3. Run the `docker images` command to confirm that the image has been successfully pulled.
This concludes OpenIM's image management strategy and the steps for pulling images. If you have any questions, please feel free to ask.

@ -54,4 +54,8 @@ git merge release-v3.1
git push origin main git push origin main
``` ```
Remember, communication with your team is key throughout this process, keeping everyone up-to-date with the changes being made. Remember, communication with your team is key throughout this process, keeping everyone up-to-date with the changes being made.
## Docker images version management

Loading…
Cancel
Save