From fa6ddd1dc5c16ce2e6ab879a9bedd759ec6893c8 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Tue, 4 Feb 2025 17:41:07 -0600 Subject: [PATCH] Update action to deploy to GitHub pages (#623) * Update action to deploy to GitHub pages This is an attempt to fix the permissions error on the last merge. The code is inspired from https://github.com/actions/upload-pages-artifact * Revert "Update action to deploy to GitHub pages" This reverts commit 93756e1ecdbac8567802fec54e8941b56f0b0cb9. * Grant more permissions * Try setting permissions on the job level * Update action to deploy to GitHub pages This is an attempt to fix the permissions error on the last merge. The code is inspired from https://github.com/actions/upload-pages-artifact * Combine * Set permissions * Fix * Fix artifact name * set contents read * Only run on merge commits --------- Co-authored-by: Daniel Arndt --- .github/workflows/deploy_docs.yml | 52 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index bd373cd11..17efcb6f2 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -6,41 +6,39 @@ on: pull_request: jobs: - build-and-deploy-docs: + build: runs-on: ubuntu-latest env: docs-directory: /home/runner/work/kokkos-core-wiki/kokkos-core-wiki/docs - python-version: '3.10' - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ env.python-version }} - uses: actions/setup-python@v4 + - uses: actions/checkout@v4.2.2 + - uses: actions/setup-python@v5.4.0 with: - python-version: ${{ env.python-version }} - architecture: 'x64' - - name: Install Python dependencies - run: | - pip3 install -r build_requirements.txt + python-version: '3.10' + - run: pip install -r build_requirements.txt - name: Build documentation working-directory: ${{ env.docs-directory }} run: | make html - - name: Archive documentation - uses: actions/upload-artifact@v4 + - name: Updload documentation as artifact + id: deployment + uses: actions/upload-pages-artifact@v3.0.1 with: - name: documentation.tar.gz + name: github-pages path: ${{ env.docs-directory }}/generated_docs - # .nojekyll file is needed for GitHub Pages to know it's getting a ready webpage - # and there is no need to generate anything - - name: Generate nojekyll file - working-directory: ${{ env.docs-directory }}/generated_docs - run: touch .nojekyll - # This action moves the content of `generated_docs` to the `deploy-doc-site` branch - - name: Deploy docs - if: ${{ github.ref == 'refs/heads/main' }} - uses: JamesIves/github-pages-deploy-action@v4 - with: - branch: deploy-doc-site - folder: ${{ env.docs-directory }}/generated_docs - clean: true + + deploy: + if: ${{ github.ref == 'refs/heads/main' }} + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + permissions: + contents: read + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4.0.5