name: Build and Publish Docs site run-name: astro build docs site on: push: branches: - main jobs: build-docs: runs-on: ubuntu-24.04 env: NODE_OPTIONS: --max-old-space-size=8192 # search only appears once the credentials are set, the build falls back # to pagefind otherwise PUBLIC_DOCSEARCH_APP_ID: ${{ secrets.DOCSEARCH_APP_ID }} PUBLIC_DOCSEARCH_API_KEY: ${{ secrets.DOCSEARCH_API_KEY }} PUBLIC_DOCSEARCH_INDEX_NAME: ${{ secrets.DOCSEARCH_INDEX_NAME }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 with: node-version: 24 cache: pnpm - name: install necessary tools run: | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install - name: prepare awesome list run: | make prepare-awesome-latest prepare-awesome\#27 prepare-awesome\#26 prepare-awesome\#25 prepare-awesome\#24 prepare-awesome\#23 prepare-awesome\#22 - name: Install dependencies run: pnpm install --frozen-lockfile - name: build site run: make build - name: aws credential configure uses: aws-actions/configure-aws-credentials@e6de054238d6b7531b4efff3b6587d9aade6a06c # v6 with: aws-access-key-id: ${{ secrets.AWS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} aws-region: ${{ secrets.AWS_REGION}} - name: Copy files to the production website with the AWS CLI run: | aws s3 sync sites/docs/dist/ s3://docs-gitea-com aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION}} --paths '/*' - name: Copy files to Cloudflare Pages env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} run: | # cloudflare/_headers and cloudflare/_redirects are only meaningful for # the Cloudflare Pages deployment, so they are copied into the build # here, after the S3 sync above has run. If they were placed in the # build any earlier, that sync would publish them to S3/CloudFront and # make them publicly readable there. cp cloudflare/_headers sites/docs/dist/_headers cp cloudflare/_redirects sites/docs/dist/_redirects test -f sites/docs/dist/_headers -a -f sites/docs/dist/_redirects || exit 1 pnpm dlx wrangler@4 pages deploy sites/docs/dist \ --project-name docs-gitea-com \ --branch main