Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Use force_orphan to prevent gh-pages branch history from ballooning repo size (#819)
sarayourfriendb6224acf7adf
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex 25d9b660e..a2adc8934 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -278,14 +278,29 @@ jobs:docker load --input /tmp/ingestion_server/ingestion_server.tar- name: Make developer docs- run: just sphinx-make+ run: |+ just sphinx-make+ mv ./api/build/html /tmp/gh-pages++ - uses: actions/checkout@v3+ with:+ ref: gh-pages++ - name: Preserve previews+ run: mv _preview /tmp/gh-pages/_preview- name: Deployuses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3with:github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: ./api/build/html/- keep_files: true+ publish_dir: /tmp/gh-pages+ force_orphan: true++ - name: Checkout branch again to enable cleaning+ if: always()+ uses: actions/checkout@v3+ with:+ ref: maindocs-preview:name: Publish preview of developer docs for the branch@@ -336,15 +351,38 @@ jobs:docker load --input /tmp/ingestion_server/ingestion_server.tar- name: Build docs- run: just sphinx-make+ run: |+ just sphinx-make+ sudo chown "$USER:$USER" -R ./api+ mv ./api/build/html /tmp/preview++ # Otherwise we end up with any extra stuff not git-ignored in the gh-pages branch+ - name: Recreate working directory to avoid superfluous files+ run: |+ cd ..+ sudo rm -rf openverse-api+ mkdir openverse-api++ - uses: actions/checkout@v3+ with:+ ref: gh-pages++ - name: Merge preview with existing gh-pages+ run: |+ cd ..+ cp -r ./openverse-api /tmp/gh-pages+ # trash the existing preview folder and replace it with the newly generated one+ # if the preview hasn't been pushed yet this will still exit(0)+ rm -rf /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}+ mv /tmp/preview /tmp/gh-pages/_preview/${{ github.event.pull_request.number }}+ cd openverse-api- name: Deployuses: peaceiris/actions-gh-pages@v3with:github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: ./api/build/html/- destination_dir: _preview/${{ github.event.pull_request.number }}- keep_files: true+ publish_dir: /tmp/gh-pages+ force_orphan: true- uses: peter-evans/find-comment@v2id: final-preview-comment@@ -364,3 +402,7 @@ jobs:Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.You can check [the GitHub pages deployment action list](https://github.com/WordPress/openverse-api/actions/workflows/pages/pages-build-deployment) to see the current status of the deployments.++ - name: Checkout branch again to enable cleaning+ uses: actions/checkout@v3+ if: always()