From 72b979357a304ef338d149586b61160154352e51 Mon Sep 17 00:00:00 2001 From: "yanlong.wang" Date: Tue, 11 Feb 2025 18:17:06 +0800 Subject: [PATCH] ci: cd gh action --- .github/workflows/cd.yml | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..a819ef7 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,66 @@ +run-name: Build push and deploy (CD) +on: + push: + branches: + - main + - ci-debug + tags: + - '*' + +jobs: + build-and-push-to-gcr: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.ref_type == 'branch' && github.ref }} + cancel-in-progress: true + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GCLOUD_SERVICE_ACCOUNT_SECRET_JSON }}' + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v2' + - name: "Docker auth" + run: |- + gcloud auth configure-docker us-docker.pkg.dev --quiet + - name: Set controller release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22.12.0 + cache: npm + + - name: npm install + run: npm ci + - name: build application + run: npm run build + - name: Set package version + run: npm version --no-git-tag-version ${{ env.RELEASE_VERSION }} + if: github.ref_type == 'tag' + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + us-docker.pkg.dev/research-df067/deepresearch/node-deep-research + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + id: container + uses: docker/build-push-action@v6 + with: + file: jina-ai/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Deploy with Tag + run: | + gcloud run deploy node-deep-research --image us-docker.pkg.dev/research-df067/deepresearch/node-deep-research@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --region us-central1 --async + \ No newline at end of file