From f3195b5ef45d988a2ffa45fccd70aaefdd5028ee Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Thu, 18 Jul 2024 18:44:34 +0200 Subject: [PATCH] [INFRA] Documentation preview --- .github/workflows/ci_documentation.yml | 50 ++++++++++++- .github/workflows/deploy_documentation.yaml | 81 --------------------- 2 files changed, 47 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/deploy_documentation.yaml diff --git a/.github/workflows/ci_documentation.yml b/.github/workflows/ci_documentation.yml index 08fbeb3b3f..69cd8cff4b 100644 --- a/.github/workflows/ci_documentation.yml +++ b/.github/workflows/ci_documentation.yml @@ -8,9 +8,10 @@ on: push: branches: - 'main' - pull_request: + pull_request_target: types: - unlabeled + - closed workflow_dispatch: concurrency: @@ -29,11 +30,19 @@ jobs: build: name: Documentation runs-on: ubuntu-latest - if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' + if: ( github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint' ) && github.event.action != 'closed' steps: - name: Checkout + if: github.event_name != 'pull_request_target' uses: actions/checkout@v4 + # pull_request_target does not checkout the merge commit by default + - name: Checkout + if: github.event_name == 'pull_request_target' + uses: actions/checkout@v4 + with: + ref: "refs/pull/${{ github.event.number }}/merge" + - name: Install Doxygen uses: seqan/actions/setup-doxygen@main with: @@ -43,8 +52,43 @@ jobs: run: | mkdir build && cd build cmake ../test/documentation - make download-cppreference-doxygen-web-tag - name: Run tests working-directory: build run: ctest . -j --output-on-failure + + - name: Deploy Preview + if: github.event_name == 'pull_request_target' + uses: seqan/actions/documentation_deploy_preview@main + with: + deploy_host: ${{ secrets.DEPLOY_HOST }} + deploy_user: ${{ secrets.DEPLOY_USER }} + deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }} + deploy_base_path: ${{ secrets.DEPLOY_PREVIEW_BASE_PATH }} + source_path_user_doc: build/doc_usr/html + source_path_developer_doc: build/doc_dev/html + token: ${{ secrets.SEQAN_ACTIONS_PAT }} + + - name: Deploy Documentation + if: github.event_name == 'push' + uses: seqan/actions/documentation_deploy_production@main + with: + deploy_host: ${{ secrets.DEPLOY_HOST }} + deploy_user: ${{ secrets.DEPLOY_USER }} + deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }} + source_path_user_doc: build/doc_usr/html/ + deploy_path_user_doc: ${{ secrets.DEPLOY_PRODUCTION_BASE_PATH }}/main_user + source_path_developer_doc: build/doc_dev/html/ + deploy_path_developer_doc: ${{ secrets.DEPLOY_PRODUCTION_BASE_PATH }}/main_dev + delete: + name: Delete Preview + runs-on: ubuntu-latest + if: github.repository_owner == 'seqan' && github.event_name == 'pull_request_target' && github.event.action == 'closed' + steps: + - name: Delete Preview + uses: seqan/actions/documentation_delete_preview@main + with: + deploy_host: ${{ secrets.DEPLOY_HOST }} + deploy_user: ${{ secrets.DEPLOY_USER }} + deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }} + deploy_base_path: ${{ secrets.DEPLOY_PREVIEW_BASE_PATH }} diff --git a/.github/workflows/deploy_documentation.yaml b/.github/workflows/deploy_documentation.yaml deleted file mode 100644 index d58e8032d1..0000000000 --- a/.github/workflows/deploy_documentation.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -name: Deploy documentation (https://docs.seqan.de/) - -on: - push: - branches: - - 'main' - # Enables a manual trigger, may run on any branch - workflow_dispatch: - -concurrency: - group: docs-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: false - -env: - TZ: Europe/Berlin - -defaults: - run: - shell: bash -Eexuo pipefail {0} - -jobs: - deploy_documentation: - name: Deploy Documentation - runs-on: ubuntu-22.04 - timeout-minutes: 30 - if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install CMake - uses: seqan/actions/setup-cmake@main - with: - cmake: 3.16.9 - - - name: Install Doxygen - uses: seqan/actions/setup-doxygen@main - with: - doxygen: 1.9.8 - - - name: Load cached documentation - uses: actions/cache@v4 - with: - path: doc-build - key: ${{ runner.os }}-documentation-1.9.8 - - - name: Build documentation - run: | - mkdir -p doc-build - cd doc-build - cmake ../test/documentation - make -j2 download-cppreference-doxygen-web-tag - ctest . -j2 --output-on-failure - - - name: Deploy User Documentation - uses: Pendect/action-rsyncer@v2.0.0 - env: - DEPLOY_KEY: ${{ secrets.DEPLOY_HOST_SSH_KEY }} - REMOTE_HOST: ${{ secrets.DEPLOY_HOST }} - REMOTE_USER: ${{ secrets.REMOTE_USER }} - TARGET: ${{ secrets.REMOTE_TARGET }} - with: - flags: '-zr --delete --timeout=60 --omit-dir-times' - src: 'doc-build/doc_usr/html/' - dest: '$REMOTE_USER@$REMOTE_HOST:$TARGET/main_user' - - - name: Deploy Developer Documentation - uses: Pendect/action-rsyncer@v2.0.0 - env: - DEPLOY_KEY: ${{ secrets.DEPLOY_HOST_SSH_KEY }} - REMOTE_HOST: ${{ secrets.DEPLOY_HOST }} - REMOTE_USER: ${{ secrets.REMOTE_USER }} - TARGET: ${{ secrets.REMOTE_TARGET }} - with: - flags: '-zr --delete --timeout=60 --omit-dir-times' - src: 'doc-build/doc_dev/html/' - dest: '$REMOTE_USER@$REMOTE_HOST:$TARGET/main_dev'