Sync from ai2-docs #11
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: Sync from ai2-docs | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download ai2-docs artifact | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| RUN_ID=$(gh api repos/fun123dotcn/ai2-docs/actions/runs --jq '.workflow_runs[0].id') | |
| ARTIFACT_ID=$(gh api repos/fun123dotcn/ai2-docs/actions/runs/$RUN_ID/artifacts --jq '.artifacts[0].id') | |
| gh api repos/fun123dotcn/ai2-docs/actions/artifacts/$ARTIFACT_ID/zip > artifact.zip | |
| rm -rf static_site artifact.tar | |
| unzip -o artifact.zip -d static_site | |
| - name: Fix paths for root domain | |
| run: | | |
| for f in static_site/*.html; do | |
| sed -i 's|href="/ai2-docs/|href="/|g' "$f" | |
| sed -i 's|src="/ai2-docs/|src="/|g' "$f" | |
| done | |
| - name: Commit and push | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cp static_site/favicon.ico . 2>/dev/null || true | |
| cp static_site/logo.png . 2>/dev/null || true | |
| cp -r static_site/_next . | |
| cp -r static_site/content . | |
| cp -r static_site/pagefind . | |
| cp static_site/index.html . | |
| cp static_site/*.ico . 2>/dev/null || true | |
| cp static_site/*.png . 2>/dev/null || true | |
| touch .nojekyll | |
| rm -rf artifact.zip artifact.tar static_site | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add -A | |
| git commit -m 'Sync from ai2-docs build' || echo 'No changes' | |
| git push origin main |