From 3f9aa796434d85f3f6be64fa3fa9b690ee725e86 Mon Sep 17 00:00:00 2001 From: Serge Koudoro Date: Fri, 8 Sep 2023 11:13:28 -0400 Subject: [PATCH] add some actions --- .github/workflows/pr-close.yml | 29 ++++++++++++++++++ .github/workflows/publish.yml | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/pr-close.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml new file mode 100644 index 00000000..a0868bf2 --- /dev/null +++ b/.github/workflows/pr-close.yml @@ -0,0 +1,29 @@ +name: delete preview on PR close +on: + pull_request: + types: [closed] + +jobs: + delete_preview: + runs-on: ubuntu-latest + env: + PR_PATH: pull/${{github.event.number}} + steps: + - name: make empty dir + run: mkdir ${{ env.PR_PATH }} + + - name: delete folder + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ${{ env.PR_PATH }} + destination_dir: ${{ env.PR_PATH }} + + - name: Comment on PR + uses: hasura/comment-progress@v2.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: deploy-preview + message: "🪓 PR closed, deleted preview at https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..c9426afd --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,54 @@ +name: github pages + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '0 0 * * 1' + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + env: + PR_PATH: pull/${{github.event.number}} + steps: + - name: Comment on PR + uses: hasura/comment-progress@v2.2.0 + if: github.ref != 'refs/heads/master' + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} + number: ${{ github.event.number }} + id: deploy-preview + message: "Starting deployment of preview ⏳..." + + - name: Checkout website repo + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + + - name: Build website + uses: ammaraskar/sphinx-action@master + with: + docs-folder: "." + + - name: Upload HTML + uses: actions/upload-artifact@v1 + with: + name: DocumentationHTML + path: _build/html/