diff --git a/.github/workflows/algolia.yml b/.github/workflows/algolia.yml deleted file mode 100644 index 32fcd103fc..0000000000 --- a/.github/workflows/algolia.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Algolia indexing - -on: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - -jobs: - delete-current-algolia-index: - env: - ALGOLIA_UPDATE_API_KEY: ${{secrets.ALGOLIA_UPDATE_API_KEY}} - ALGOLIA_SEARCH_API_KEY: ${{secrets.ALGOLIA_SEARCH_API_KEY}} - ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}} - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/gallium - - run: npm ci - - name: Run delete script - run: npm -w @taquito/website run delete-index - - name: Algolia Indexing - run: | - docker run --rm -e "CONFIG=$(cat ./website/config.json | jq -r tostring)" \ - -e API_KEY=${{secrets.ALGOLIA_UPDATE_API_KEY}} \ - -e APPLICATION_ID=${{secrets.ALGOLIA_APPLICATION_ID}} \ - algolia/docsearch-scraper - - - name: Slack Notification - if: always() - uses: ravsamhq/notify-slack-action@v1 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "Taquito Algolia Indexing ${{job.status}}" - message_format: "{emoji} *{workflow}* {status_message} on <{commit_url}|{commit_sha}> | <{run_url}|View Run>" - env: - SLACK_WEBHOOK_URL: ${{ secrets.ALGOLIA_SLACK_WEBHOOK }} - - - - - - - - - - - - - - - diff --git a/.github/workflows/deploy_website.yml b/.github/workflows/deploy_website.yml index 50370bf870..b508434204 100644 --- a/.github/workflows/deploy_website.yml +++ b/.github/workflows/deploy_website.yml @@ -42,6 +42,16 @@ jobs: env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + + - name: Update Algolia Index + if: github.ref == 'refs/heads/master' + run: | + docker run --rm -e "CONFIG=$(cat ./website/config.json | jq -r tostring)" \ + -e API_KEY=${{secrets.ALGOLIA_UPDATE_API_KEY}} \ + -e APPLICATION_ID=${{secrets.ALGOLIA_APPLICATION_ID}} \ + algolia/docsearch-scraper + + # Notify the PR of the deploy preview - uses: marocchino/sticky-pull-request-comment@v2 if: github.event_name == 'pull_request' with: diff --git a/website/scripts/delete-index.js b/website/scripts/delete-index.js deleted file mode 100644 index afacbc71c5..0000000000 --- a/website/scripts/delete-index.js +++ /dev/null @@ -1,16 +0,0 @@ -require('dotenv').config(); - -const algoliasearch = require('algoliasearch'); - -const client = algoliasearch( - process.env.ALGOLIA_APPLICATION_ID, - process.env.ALGOLIA_UPDATE_API_KEY -); -const index = client.initIndex('taquito'); - -try { - index.delete(); - console.log('Successfully deleted index: taquito'); -} catch(e) { - console.log(`Failed to delete Algolia index: ${e}`); -}