Skip to content

feat(system): 新增团队管理功能 #64

feat(system): 新增团队管理功能

feat(system): 新增团队管理功能 #64

Workflow file for this run

name: Docker Build and Push
on:
push:
tags:
- 'v*' # 触发条件可以根据你的需求修改
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
run: echo "${{ secrets.REPO_PASS }}" | docker login -u "${{ secrets.REPO }}" --password-stdin
- name: Get the latest tag
id: get_latest_tag
run: |
latest_tag=$(git describe --tags --always)
echo "Latest tag is $latest_tag"
echo "::set-output name=latest_tag::$latest_tag"
- name: Build and push Docker image
run: |
chmod +x build_images.sh
./build_images.sh "${{ secrets.REPO }}"
env:
REPO: ${{ secrets.REPO }}
REPO_PASS: ${{ secrets.REPO_PASS }}
- name: Send Release Notification
if: success()
run: |
curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"moon项目更新通知","content":[[{"tag":"text","text":"moon-frontend项目有更新, 当前版本为: "},{"tag":"a","text":"${{ steps.get_latest_tag.outputs.latest_tag }}","href":"https://hub.docker.com/r/aidemoonio/moon-frontend/tags?name=${{ steps.get_latest_tag.outputs.latest_tag }}"}],[],[{"tag":"at","user_id":"all"}]]}}}}' ${{ secrets.HOOK }}
- name: Set up kubeconfig
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
env:
KUBECONFIG: $HOME/.kube/config
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Deploy to Kubernetes
run: |
kubectl --insecure-skip-tls-verify set image deployment/moon-frontend moon-frontend=docker.cloudimages.asia/${{ secrets.REPO }}/moon-frontend:${{ steps.get_latest_tag.outputs.latest_tag }} -n ${{ secrets.K8S_NAMESPACE }}
- name: verify deployment
run: |
kubectl --insecure-skip-tls-verify rollout status deployment/moon-frontend -n ${{ secrets.K8S_NAMESPACE }}
curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"moon项目部署通知","content":[[{"tag":"text","text":"moon-frontend项目自动部署完成, 当前版本为: "},{"tag":"a","text":"${{ steps.get_latest_tag.outputs.latest_tag }}","href":"https://moon.aide-cloud.cn"}],[],[{"tag":"at","user_id":"all"}]]}}}}' ${{ secrets.HOOK }}