| name: PouchDB Docs |
| |
| on: |
| push: |
| branches: [master] |
| paths: |
| - '.github/actions/**' |
| - '.github/workflows/docs.yml' |
| - 'package.json' |
| - 'bin/**' |
| - 'docs/**' |
| |
| jobs: |
| |
| test-docs: |
| runs-on: ubuntu-22.04 |
| steps: |
| - name: Checkout PouchDB repo |
| uses: actions/checkout@v4 |
| with: |
| persist-credentials: false |
| - uses: ./.github/actions/install-node-package |
| with: |
| node-version: 24 |
| - run: BUILD=1 npm run build-site |
| - name: Checkout pouchdb-site repo |
| uses: actions/checkout@v4 |
| with: |
| repository: apache/pouchdb-site |
| ref: asf-site |
| path: checked-out-pouchdb-site |
| fetch-depth: 0 |
| token: ${{ secrets.POUCHDB_WEBSITE_BUILD }} |
| - name: Commit and push if changed |
| env: |
| POUCHDB_WEBSITE_BUILD: ${{ secrets.POUCHDB_WEBSITE_BUILD }} |
| run: | |
| cd checked-out-pouchdb-site |
| |
| # git remote add deploy https://asf-ci-deploy:$POUCHDB_WEBSITE_BUILD@github.com/apache/pouchdb-site |
| |
| echo "Git remotes:" |
| git remote -v |
| |
| git config user.email ${{ github.actor }}@users.noreply.github.com |
| git config user.name ${{ github.actor }} |
| |
| git rm -rf . || true |
| |
| cp -R ../docs/_site/. . |
| |
| if [[ -n $(git status --porcelain) ]]; then |
| echo "Committing changes…" |
| git add -A |
| git commit -m "Deploy site from ${GITHUB_REPOSITORY}@${GITHUB_SHA}" |
| GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push origin asf-site --force |
| else |
| echo "No changes to commit" |
| fi |