Submit Sitemap to Google #19
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: Submit Sitemap to Google | |
| on: | |
| workflow_run: | |
| workflows: | |
| - Publish Blog Article | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| inputs: | |
| sitemap_url: | |
| description: "Override sitemap URL (optional)" | |
| required: false | |
| permissions: {} | |
| env: | |
| SITEMAP_URL: https://magicui.design/sitemap.xml | |
| SITE_URL: sc-domain:magicui.design | |
| jobs: | |
| submit-sitemap: | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm install --no-save googleapis google-auth-library | |
| - name: Publish Sitemap | |
| run: node .github/scripts/submit-sitemap.mjs | |
| env: | |
| GOOGLE_SEARCH_CONSOLE_JSON_KEY: ${{ secrets.GOOGLE_SEARCH_CONSOLE_JSON_KEY }} | |
| SITE_URL: ${{ env.SITE_URL }} | |
| SITEMAP_URL: ${{ inputs.sitemap_url || env.SITEMAP_URL }} |