diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3751f59..953af22 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,7 +14,7 @@ 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..7615d61 --- /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-trade +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 cf4d6a2..21aff7f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -2,7 +2,7 @@ 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 c36174a..22216a6 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -8,7 +8,7 @@ name: Upgrade on: push: # Publish semver tags as releases. - tags: [ 'v*.*.*' ] + branches: [ "main" ] pull_request: branches: [ "main" ]