diff --git a/.github/workflows/deploy-dev.yaml b/.github/workflows/deploy-dev.yaml index 59533a1..e988bb4 100644 --- a/.github/workflows/deploy-dev.yaml +++ b/.github/workflows/deploy-dev.yaml @@ -7,6 +7,10 @@ on: paths-ignore: - '**.md' - '.gitignore' + workflow_run: + workflows: ["Sync main to dev"] + types: + - completed env: REGISTRY: ghcr.io @@ -15,6 +19,9 @@ env: jobs: build-server: + if: > + github.event_name == 'push' || + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') uses: ./.github/workflows/build-push-image.yaml permissions: contents: read @@ -23,7 +30,7 @@ jobs: service: mcp-server registry: ghcr.io image_name: ${{ github.repository }} - tag: dev-${{ github.sha }} + tag: dev-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} additional_tag: dev-latest deploy: @@ -36,6 +43,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'workflow_run' && 'dev' || github.ref }} - name: Set up kubeconfig run: | @@ -45,7 +54,7 @@ jobs: - name: Update deployment files run: | - TAG="dev-${{ github.sha }}" + TAG="dev-${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}" sed -i "s|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:.*|image: ghcr.io/${{ env.IMAGE_NAME }}/mcp-server:${TAG}|" deploy/01_server.yaml - name: Deploy to Kubernetes