From a9dcc915382ae16762614db37fb1338842a45e3d Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 24 Mar 2025 15:42:36 +0700 Subject: [PATCH 1/4] ci: add cortex docs new release --- .github/workflows/cortex-docs-new-release.yml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/cortex-docs-new-release.yml diff --git a/.github/workflows/cortex-docs-new-release.yml b/.github/workflows/cortex-docs-new-release.yml new file mode 100644 index 000000000..42f4e7fa0 --- /dev/null +++ b/.github/workflows/cortex-docs-new-release.yml @@ -0,0 +1,64 @@ +name: Deploy Docs on new release + +on: + release: + types: + - published + - edited + - released + +jobs: + deploy: + name: Deploy to CloudFlare Pages + env: + CLOUDFLARE_PROJECT_NAME: cortex-docs + runs-on: ubuntu-latest + permissions: + contents: write + deployments: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + ref: dev + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.1 + + - name: Fill env vars + working-directory: docs + continue-on-error: true + run: | + env_example_file=".env.example" + touch .env + while IFS= read -r line || [[ -n "$line" ]]; do + if [[ "$line" == *"="* ]]; then + var_name=$(echo $line | cut -d '=' -f 1) + echo $var_name + var_value="$(jq -r --arg key "$var_name" '.[$key]' <<< "$SECRETS")" + echo "$var_name=$var_value" >> .env + fi + done < "$env_example_file" + env: + SECRETS: '${{ toJson(secrets) }}' + + - name: Install dependencies + working-directory: docs + run: yarn install + - name: Build website + working-directory: docs + run: export NODE_ENV=production && yarn build && cp _redirects build/_redirects + + - name: Publish to Cloudflare Pages Production + uses: cloudflare/pages-action@v1 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }} + directory: ./docs/build + branch: main + # Optional: Enable this if you want to have GitHub Deployments triggered + gitHubToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 1d8487c665337dffcccb6340a147f0c1c90691ab Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 24 Mar 2025 15:44:45 +0700 Subject: [PATCH 2/4] chore: add pr to dev to test ci --- .github/workflows/cortex-docs-new-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cortex-docs-new-release.yml b/.github/workflows/cortex-docs-new-release.yml index 42f4e7fa0..b52e5e0dc 100644 --- a/.github/workflows/cortex-docs-new-release.yml +++ b/.github/workflows/cortex-docs-new-release.yml @@ -6,6 +6,9 @@ on: - published - edited - released + pull_request: + branches: + - dev jobs: deploy: From 013aeb0fde61b1a5b64e99500d6c86ef9515dda7 Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 24 Mar 2025 16:02:11 +0700 Subject: [PATCH 3/4] ci: update redirect continue on error --- .github/workflows/cortex-docs-new-release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cortex-docs-new-release.yml b/.github/workflows/cortex-docs-new-release.yml index b52e5e0dc..fbe4d718a 100644 --- a/.github/workflows/cortex-docs-new-release.yml +++ b/.github/workflows/cortex-docs-new-release.yml @@ -53,8 +53,13 @@ jobs: run: yarn install - name: Build website working-directory: docs - run: export NODE_ENV=production && yarn build && cp _redirects build/_redirects + run: export NODE_ENV=production && yarn build + - name: Copy redirect file + working-directory: docs + continue-on-error: true + run: cp _redirects build/_redirects + - name: Publish to Cloudflare Pages Production uses: cloudflare/pages-action@v1 with: From d457414dfeaf012db3e917f58ed3d37a2b925290 Mon Sep 17 00:00:00 2001 From: Minh141120 Date: Mon, 24 Mar 2025 17:16:49 +0700 Subject: [PATCH 4/4] ci: remove pr dev testing --- .github/workflows/cortex-docs-new-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cortex-docs-new-release.yml b/.github/workflows/cortex-docs-new-release.yml index fbe4d718a..bdb86276e 100644 --- a/.github/workflows/cortex-docs-new-release.yml +++ b/.github/workflows/cortex-docs-new-release.yml @@ -6,9 +6,6 @@ on: - published - edited - released - pull_request: - branches: - - dev jobs: deploy: