From 12d3aedec7be0b78fb1ac70cfc8b7ebf88816dc2 Mon Sep 17 00:00:00 2001 From: Rob Taylor Date: Thu, 1 Feb 2024 02:49:52 +0000 Subject: [PATCH] switch to rossjrw/pr-preview-action --- .github/workflows/gh-pages.yml | 84 ---------------------------------- .github/workflows/preview.yml | 39 ++++++++++++++++ 2 files changed, 39 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/gh-pages.yml create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index fd27114ef..000000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: github pages -permissions: write-all - -on: - push: - branches: - - main # deploy main. If your branch is `master`, you'll have to replace that throughout this file. - pull_request: # This will publish a site preview on every pull request, and also run the build command to test if the site is broken. - -jobs: - deploy: - runs-on: ubuntu-22.04 - env: - PR_PATH: pull/${{github.event.number}} - steps: - - name: Comment on PR - uses: hasura/comment-progress@v2.3.0 - if: github.ref != 'refs/heads/main' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }} - number: ${{ github.event.number }} - id: deploy-preview - message: "Starting deployment of preview ⏳..." - - - name: Set domain - run: echo "DOMAIN=lip6.github.io" >> $GITHUB_ENV # TODO set your custom domain - # If you're using the default github pages url, use this instead: - # run: echo "DOMAIN=${{ github.actor }}.github.io" >> $GITHUB_ENV - - - name: Checkout website repo - uses: actions/checkout@v4 - with: - submodules: true # fetch the theme - # you need to set this as an environment env if your repo or any submodules (e.g the theme) is private: - # token: ${{ secrets.PRIVATE_REPO_TOKEN }} - - - name: Set production base URL - run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/" >> $GITHUB_ENV - - - name: Setup PDM - uses: pdm-project/setup-pdm@c050bdcb2405837648035b6678c75609d53a749f - - - name: Build website - run: | - sudo apt update - sudo apt install -y graphviz doxygen doxygen-latex python3-docutils qtbase5-dev libqt5svg5-dev - pdm sync -d --no-self - pdm run meson setup --prefix=/home/runner/work/install -D docs=true -D only-docs=true -D docs-siteurl=$BASE_URL builddir - pdm run meson install -C builddir - - - name: Deploy if this is the `main` branch - uses: JamesIves/github-pages-deploy-action@v4 - if: github.ref == 'refs/heads/main' - with: - folder: /home/runner/work/install/share/doc/html - - - name: Set base URL for preview if PR - if: github.ref != 'refs/heads/main' - run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV - - - name: Build PR preview website - if: github.ref != 'refs/heads/main' - run: | - pdm run meson setup -D docs=true -D docs-siteurl=$BASE_URL builddir - pdm run meson install -C builddir - - - name: Deploy to PR preview - uses: JamesIves/github-pages-deploy-action@v4 - if: github.ref != 'refs/heads/main' - with: - folder: /home/runner/work/install/share/doc/html - target-folder: ${{ env.PR_PATH }} # TODO you need to set this if you're using a custom domain. Otherwise you can remove it. - force: true - - - name: Update comment - uses: hasura/comment-progress@v2.2.0 - if: github.ref != 'refs/heads/main' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }} - number: ${{ github.event.number }} - id: deploy-preview - message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. Since this is a preview of production, content with `draft: true` will not be rendered. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..0a647fed8 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,39 @@ +# .github/workflows/preview.yml +name: Deploy PR previews + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: preview-${{ github.ref }} + +jobs: + deploy-preview: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: true # fetch the theme + + - name: Install website build dependencies + sudo apt update + sudo apt install -y graphviz doxygen doxygen-latex python3-docutils qtbase5-dev libqt5svg5-dev + + - name: Setup PDM + uses: pdm-project/setup-pdm@c050bdcb2405837648035b6678c75609d53a749f + + - name: Build website + run: | + pdm sync -d --no-self + pdm run meson setup --prefix=/home/runner/work/install -D docs=true -D only-docs=true -D docs-siteurl=$BASE_URL builddir + pdm run meson install -C builddir + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: /home/runner/work/install/share/doc/html