Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

wip

wip #110

Workflow file for this run

name: docs
on:
push:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
branches:
- '**'
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
working-directory: ./docs
run: bun install --frozen-lockfile
- name: Build for production
working-directory: ./docs
run: bun run build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Docs-artifacts
path: docs/build/
if-no-files-found: error
deploy:
if: ${{github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Docs-artifacts
path: docs/build/
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.DOCS_CLOUDFLARE_API_TOKEN }}
accountId: 034f5089bb082eb57cefc432b42b984d
workingDirectory: 'docs'
command: pages deploy build --project-name=fct-app-docs --commit-dirty=true
- name: Create GitHub Deployment
uses: actions/github-script@v7
with:
script: |
const ref = context.payload.ref || context.ref;
const deployment = await github.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
required_contexts: [],
environment: 'fct-app-docs (production)',
description: 'fct-app-docs',
auto_merge: false,
production_environment: true,
});
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.data.id,
state: 'success',
environment_url: 'https://docs.fctapp.cacic.dev.br',
});
scrape:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Algolia Crawler creation and crawl
uses: algolia/algoliasearch-crawler-github-actions@v1.1.10
id: algolia_crawler
with:
crawler-user-id: ${{ secrets.DOCS_ALGOLIA_CRAWLER_USER_ID }}
crawler-api-key: ${{ secrets.DOCS_ALGOLIA_CRAWLER_API_KEY }}
algolia-app-id: ${{ secrets.DOCS_ALGOLIA_APP_ID }}
algolia-api-key: ${{ secrets.DOCS_ALGOLIA_API_KEY }}
site-url: 'https://docs.fctapp.cacic.dev.br'
crawler-name: 'fctapp-yudi'