From 2368e6c782208b97b63493619581c6860b39f5e7 Mon Sep 17 00:00:00 2001 From: LJ Date: Tue, 10 Jun 2025 22:56:42 -0700 Subject: [PATCH] ops(docs-release): trigger docs release after binary release --- .github/workflows/_doc_release.yml | 31 +++++++++++++++++++ .github/workflows/docs.yml | 49 +++--------------------------- .github/workflows/release.yml | 5 +++ .gitignore | 2 +- 4 files changed, 41 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/_doc_release.yml diff --git a/.github/workflows/_doc_release.yml b/.github/workflows/_doc_release.yml new file mode 100644 index 000000000..1f57b0e16 --- /dev/null +++ b/.github/workflows/_doc_release.yml @@ -0,0 +1,31 @@ +name: Release Docs + +on: + workflow_call: + +jobs: + deploy: + runs-on: ubuntu-latest + environment: docs-release + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + cache-dependency-path: docs/yarn.lock + - uses: webfactory/ssh-agent@v0.5.0 + with: + ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} + - name: Deploy to GitHub Pages + env: + USE_SSH: true + run: | + export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ vars.COCOINDEX_DOCS_POSTHOG_API_KEY }} + export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ vars.COCOINDEX_DOCS_MIXPANEL_API_KEY }} + export COCOINDEX_DOCS_ALGOLIA_APP_ID=${{ vars.COCOINDEX_DOCS_ALGOLIA_APP_ID }} + export COCOINDEX_DOCS_ALGOLIA_API_KEY=${{ vars.COCOINDEX_DOCS_ALGOLIA_API_KEY }} + git config --global user.email "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_EMAIL }}" + git config --global user.name "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_NAME }}" + yarn --cwd docs install --frozen-lockfile + yarn --cwd docs deploy diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9defc818a..ea077f3b3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,11 +6,6 @@ on: paths: - docs/** - ".github/workflows/docs.yml" - push: - branches: [main] - paths: - - docs/** - - ".github/workflows/docs.yml" workflow_dispatch: permissions: @@ -18,7 +13,7 @@ permissions: jobs: test-deploy: - if: github.event_name != 'push' + if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -32,43 +27,7 @@ jobs: - name: Test build website run: yarn --cwd docs build - deploy-precheck: - if: ${{ github.event_name != 'pull_request' }} - runs-on: ubuntu-latest - environment: docs-release - outputs: - gh-deploy-key: ${{ steps.gh-deploy-key.outputs.defined }} - steps: - - id: gh-deploy-key - env: - GH_PAGES_DEPLOY: ${{ secrets.GH_PAGES_DEPLOY }} - if: "${{ env.GH_PAGES_DEPLOY != '' }}" - run: echo "defined=true" >> $GITHUB_OUTPUT - deploy: - needs: [deploy-precheck] - if: ${{ needs.deploy-precheck.outputs.gh-deploy-key == 'true' }} - runs-on: ubuntu-latest - environment: docs-release - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn - cache-dependency-path: docs/yarn.lock - - uses: webfactory/ssh-agent@v0.5.0 - with: - ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} - - name: Deploy to GitHub Pages - env: - USE_SSH: true - run: | - export COCOINDEX_DOCS_POSTHOG_API_KEY=${{ vars.COCOINDEX_DOCS_POSTHOG_API_KEY }} - export COCOINDEX_DOCS_MIXPANEL_API_KEY=${{ vars.COCOINDEX_DOCS_MIXPANEL_API_KEY }} - export COCOINDEX_DOCS_ALGOLIA_APP_ID=${{ vars.COCOINDEX_DOCS_ALGOLIA_APP_ID }} - export COCOINDEX_DOCS_ALGOLIA_API_KEY=${{ vars.COCOINDEX_DOCS_ALGOLIA_API_KEY }} - git config --global user.email "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_EMAIL }}" - git config --global user.name "${{ vars.COCOINDEX_DOCS_DEPLOY_USER_NAME }}" - yarn --cwd docs install --frozen-lockfile - yarn --cwd docs deploy + name: Release Docs + if: ${{ github.event_name == 'workflow_dispatch' }} + uses: ./.github/workflows/_doc_release.yml \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0c44776b..c37a6a551 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -107,3 +107,8 @@ jobs: with: command: upload args: --non-interactive --skip-existing wheels-*/* + + release-docs: + name: Release Docs + needs: [release] + uses: ./.github/workflows/_doc_release.yml diff --git a/.gitignore b/.gitignore index 33ca2b3d4..2b7f2111f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ __pycache__/ *.so # Distribution / packaging -.venv/ +.venv*/ dist/ .DS_Store