diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8df3f18fd..158bf5ad8 100755 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,6 +14,11 @@ on: type: boolean required: true default: false + upload: + description: 'Upload documentation (pdfs in _static/)' + type: boolean + required: true + default: false defaults: run: @@ -70,7 +75,7 @@ jobs: - name: Generate build files env: - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_TOKEN: ${{ (env.python_version == env.python_deploy_version && (github.event.inputs.deploy || github.event.inputs.upload)) && secrets.GITHUB_TOKEN || 'NONE' }} run: | make prepare @@ -78,22 +83,27 @@ jobs: run: | make impatient-guide ls -lAFgh build/impatient-guide/build/html/index.html - mkdir -p build/deploy - mv build/impatient-guide/build/html build/deploy/impatient - ls -lAFgh build/impatient-guide/build/latex/NXImpatient.pdf + mkdir -p build/html + mv build/impatient-guide/build/html build/html/impatient - name: Build User Manual run: | make pdf make html ls -lAFgh build/manual/build/html/index.html - mkdir -p build/deploy - mv build/manual/build/html/* build/deploy - ls -lAFgh build/manual/build/latex/nexus.pdf + mkdir -p build/html + mv build/manual/build/html/* build/html - name: Deploy both the User Manual and the Impatient Guide if: ${{ github.event.inputs.deploy && env.python_version == env.python_deploy_version }} uses: JamesIves/github-pages-deploy-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - folder: build/deploy + folder: build/html + + - name: Upload the User Manual and the Impatient Guide + if: ${{ github.event.inputs.upload && env.python_version == env.python_deploy_version }} + uses: actions/upload-artifact@v3 + with: + name: nexus-definitions-docs + path: build/html diff --git a/dev_tools/utils/github.py b/dev_tools/utils/github.py index f6cb1d237..f286594eb 100755 --- a/dev_tools/utils/github.py +++ b/dev_tools/utils/github.py @@ -38,8 +38,10 @@ def get_file_contributors_via_api(repo_name, file_path): returns a sorted dict of unique contributors to a file, or None if no GH_TOKEN has been defined in os.environ """ have_token = False - if "GH_TOKEN" in os.environ.keys(): - access_token = os.environ["GH_TOKEN"] + access_token = os.getenv("GH_TOKEN") + if ( + access_token is not None and access_token != "NONE" + ): # latter clause is false in most CI cases if len(access_token) > 0: have_token = True else: