89 lines
4.4 KiB
YAML
89 lines
4.4 KiB
YAML
run-name: Build push and deploy (CD)
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- ci-debug
|
|
- dev
|
|
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
|
|
submodules: true
|
|
token: ${{ secrets.THINAPPS_SHARED_READ_TOKEN }}
|
|
- 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'
|
|
with:
|
|
install_components: beta
|
|
- 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: get maxmind mmdb
|
|
run: mkdir -p licensed && curl -o licensed/GeoLite2-City.mmdb https://raw.githubusercontent.com/P3TERX/GeoLite.mmdb/download/GeoLite2-City.mmdb
|
|
- name: get source han sans font
|
|
run: curl -o licensed/SourceHanSansSC-Regular.otf https://raw.githubusercontent.com/adobe-fonts/source-han-sans/refs/heads/release/OTF/SimplifiedChinese/SourceHanSansSC-Regular.otf
|
|
- 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/reader-6b7dc/jina-reader/reader
|
|
- 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:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Deploy CRAWL with Tag
|
|
run: |
|
|
gcloud beta run deploy crawl --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/crawl.js --region us-central1 --async --min-instances 0 --deploy-health-check --use-http2
|
|
- name: Deploy SEARCH with Tag
|
|
run: |
|
|
gcloud beta run deploy search --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/search.js --region us-central1 --async --min-instances 0 --deploy-health-check --use-http2
|
|
- name: Deploy SERP with Tag
|
|
run: |
|
|
gcloud beta run deploy serp --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/serp.js --region us-central1 --async --min-instances 0 --deploy-health-check --use-http2
|
|
- name: Deploy CRAWL-EU with Tag
|
|
run: |
|
|
gcloud beta run deploy crawl-eu --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/crawl.js --region europe-west1 --async --min-instances 0 --deploy-health-check --use-http2
|
|
- name: Deploy SEARCH-EU with Tag
|
|
run: |
|
|
gcloud beta run deploy search-eu --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/search.js --region europe-west1 --async --min-instances 0 --deploy-health-check --use-http2
|
|
- name: Deploy SERP-HK with Tag
|
|
run: |
|
|
gcloud beta run deploy serp-hk --image us-docker.pkg.dev/reader-6b7dc/jina-reader/reader@${{steps.container.outputs.imageid}} --tag ${{ env.RELEASE_VERSION }} --command '' --args build/stand-alone/serp.js --region asia-east2 --async --min-instances 0 --deploy-health-check --use-http2 |