From c1e782c736d0251e21ec645df4b3cb0f48539356 Mon Sep 17 00:00:00 2001 From: Lansong <2095621390@qq.com> Date: Sun, 11 Feb 2024 20:08:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=93tag=E8=87=AA=E5=8A=A8=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=88=B0=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeql-analysis.yml | 1 - .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++ .github/workflows/static-analysis.yml | 1 - .github/workflows/upgrade.yml | 2 -- 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3751f59..04a6ffd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,7 +14,6 @@ name: "CodeQL" on: push: branches: [ "main" ] - tags: [ "v*.*.*" ] pull_request: # The branches below must be a subset of the branches above branches: [ "main" ] diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..4b5f0cd --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish +on: + push: + tags: + - '*' +env: + REGISTRY: docker.io + USERNAME: lansongxx + IMAGE_NAME: cloudmind-system +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Kubectl + uses: azure/setup-kubectl@v3 + with: + version: ${{ vars.KUBE_VERSION }} + + - name: Deploy + run: | + TAG_NAME="${GITHUB_REF#refs/tags/}" + mkdir $HOME/.kube + echo "${{ secrets.KUBE_CONFIG }}" > $HOME/.kube/config + kubectl get deployment ${{ env.IMAGE_NAME }} -n ${{ vars.BASE_NAMESPACE }} -o yaml |\ + sed "s|^\( - image: ${USERNAME}/${IMAGE_NAME}:\).*\$|\1${TAG_NAME}|" |\ + kubectl apply -f - \ No newline at end of file diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 010aafd..e8b0b13 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,7 +2,6 @@ name: CI on: push: branches: [ "main" ] - tags: [ "v*.*.*" ] pull_request: branches: [ "main" ] diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index 8b14c40..5b3929d 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -7,8 +7,6 @@ name: Upgrade on: push: - # Publish semver tags as releases. - tags: [ 'v*.*.*' ] branches: [ "main" ] pull_request: branches: [ "main" ]