style: update docs index style #100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_call: | |
inputs: | |
locales: | |
description: 'Comma-separated list of locales to deploy (e.g., en,zh-hans). Leave empty to deploy all enabled locales.' | |
required: false | |
type: string | |
workflow_dispatch: | |
inputs: | |
locales: | |
description: 'Comma-separated list of locales to deploy (e.g., en,zh-hans). Leave empty to deploy all enabled locales.' | |
required: false | |
type: string | |
push: | |
branches: | |
- main | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix-include: ${{ steps.check-locales.outputs.matrix-include }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: ${{ github.event_name == 'push' && 0 || 1 }} | |
- name: Check locale changes | |
id: check-locales | |
uses: ./.github/actions/check-locale-changes | |
with: | |
trigger-type: ${{ github.event_name == 'workflow_dispatch' && 'manual' || 'auto' }} | |
manual-locales: ${{ github.event.inputs.locales }} | |
test: | |
needs: check-changes | |
if: needs.check-changes.outputs.matrix-include != '[]' | |
uses: ./.github/workflows/test-e2e.yml | |
with: | |
matrix-include: ${{ needs.check-changes.outputs.matrix-include }} | |
secrets: inherit | |
deploy-and-update-index: | |
needs: [check-changes, test] | |
if: needs.check-changes.outputs.matrix-include != '[]' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: ${{ fromJson(needs.check-changes.outputs.matrix-include) }} | |
name: Deploy ${{ matrix.locale }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- uses: ./.github/actions/setup | |
- uses: ./.github/actions/vercel-pull | |
with: | |
environment: production | |
prodFlag: --prod | |
vercel_project_id: ${{ secrets[matrix.secret_project_id] }} | |
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel_token: ${{ secrets.VERCEL_TOKEN }} | |
- uses: ./.github/actions/vercel-build | |
with: | |
environment: production | |
prodFlag: --prod | |
vercel_project_id: ${{ secrets[matrix.secret_project_id] }} | |
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel_token: ${{ secrets.VERCEL_TOKEN }} | |
- id: deploy | |
uses: ./.github/actions/vercel-deploy | |
with: | |
environment: production | |
prodFlag: --prod | |
vercel_project_id: ${{ secrets[matrix.secret_project_id] }} | |
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel_token: ${{ secrets.VERCEL_TOKEN }} | |
- name: Update Search Index | |
shell: bash | |
run: pnpm run docs:update-search-index | |
- name: Check if locale has sitemap | |
id: check-sitemap | |
shell: bash | |
run: | | |
SITEMAP_URL=$(jq -r --arg locale "${{ matrix.locale }}" '.[$locale].sitemap // empty' .github/locales-config.json) | |
if [ -n "$SITEMAP_URL" ]; then | |
echo "has_sitemap=true" >> $GITHUB_OUTPUT | |
echo "sitemap_url=$SITEMAP_URL" >> $GITHUB_OUTPUT | |
echo "✅ Locale ${{ matrix.locale }} has sitemap: $SITEMAP_URL" | |
else | |
echo "has_sitemap=false" >> $GITHUB_OUTPUT | |
echo "ℹ️ Locale ${{ matrix.locale }} does not have a sitemap configured" | |
fi | |
- name: Submit Sitemap to Google Search Console | |
if: steps.check-sitemap.outputs.has_sitemap == 'true' | |
shell: bash | |
env: | |
GOOGLE_SERVICE_ACCOUNT_EMAIL: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_EMAIL }} | |
GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY }} | |
run: | | |
echo "🚀 Submitting sitemap for locale ${{ matrix.locale }}" | |
pnpm run docs:submit-sitemap sc-domain:nextjs.im --sitemap-urls "${{ steps.check-sitemap.outputs.sitemap_url }}" |