Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Try enabling use of force_orphan for gh-pages (#1574)
sarayourfriendb587ec77aeb7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 93ff9c453..32f6f9c58 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -256,15 +256,38 @@ jobs:# This makes the TCV available at the `/tailwind` directory in the gh-pages- name: Merge TCV and Storybook builds- run: mv .tcv-export ./storybook-static/tailwind+ run: |+ mv .tcv-export ./storybook-static/tailwind+ mv ./storybook-static /tmp/preview++ # Otherwise we end up with `node_modules` and other things only necessary for building+ # but not necessary for deploying the `gh-pages` branch+ - name: Recreate working directory to avoid supurflouous files+ run: |+ cd ..+ rm -rf openverse-frontend+ mkdir openverse-frontend++ - uses: actions/checkout@v3+ with:+ ref: gh-pages++ - name: Merge preview with existing gh-pages+ run: |+ cd ..+ cp -r ./openverse-frontend /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-frontend- name: Deployuses: peaceiris/actions-gh-pages@v3with:github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: ./storybook-static- destination_dir: ${{ 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@@ -279,9 +302,13 @@ jobs:body: |**Storybook and Tailwind configuration previews**: _Ready_- **Storybook:** <https://wordpress.github.io/openverse-frontend/${{ github.event.pull_request.number }}>- **Tailwind:** <https://wordpress.github.io/openverse-frontend/${{ github.event.pull_request.number }}/tailwind>+ **Storybook:** <https://wordpress.github.io/openverse-frontend/_preview/${{ github.event.pull_request.number }}>+ **Tailwind:** <https://wordpress.github.io/openverse-frontend/_preview/${{ github.event.pull_request.number }}/tailwind>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-frontend/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()diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yamlindex 530c12bfa..379c1be5b 100644--- a/.github/workflows/gh-pages.yaml+++ b/.github/workflows/gh-pages.yaml@@ -11,6 +11,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v3+ with:+ ref: main- uses: ./.github/actions/setup-node-env@@ -25,11 +27,27 @@ jobs:# This makes the TCV available at the `/tailwind` directory in the gh-pages- name: Merge TCV and Storybook builds- run: mv .tcv-export ./storybook-static/tailwind+ run: |+ mv .tcv-export ./storybook-static/tailwind+ mv storybook-static /tmp/gh-pages++ - name: Checkout+ uses: actions/checkout@v3+ with:+ ref: gh-pages++ - name: Preserve previews+ run: mv _preview /tmp/gh-pages/_preview- name: Deployuses: peaceiris/actions-gh-pages@v3with:github_token: ${{ secrets.GITHUB_TOKEN }}- publish_dir: ./storybook-static- 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: maindiff --git a/.github/workflows/pr_closed.yml b/.github/workflows/pr_closed.ymlindex 48d4a983e..041a46aec 100644--- a/.github/workflows/pr_closed.yml+++ b/.github/workflows/pr_closed.yml@@ -16,11 +16,11 @@ jobs:ref: gh-pages- name: Remove PR preview- run: rm -rf ${{ github.event.pull_request.number }}+ run: rm -rf _preview/${{ github.event.pull_request.number }}- name: Push cleaned branchrun: |git config --global user.name 'PR Closed action'git config --global user.email '[email protected]'- git commit -am 'Clean preview for PR ${{ github.event.pull_request.number }}'- git push+ git reset "$(git commit-tree 'HEAD^{tree}' -m 'Clean preview for PR #${{ github.event.pull_request.number }}')"+ git push --force