Skip to content

Change gdq tutorial. Refs (#4594) #5859

Change gdq tutorial. Refs (#4594)

Change gdq tutorial. Refs (#4594) #5859

Workflow file for this run

# This code is a Qiskit project.
#
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
name: PR preview
on:
pull_request:
paths:
- "docs/**/*"
- "learning/**/*"
- "public/images/**/*"
# PR previews don't build API docs.
- "!docs/api/**/*"
- "!public/images/api/**/*"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
pr-preview:
name: PR preview
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
env:
PR_PREVIEW_PATH: pr-${{ github.event.pull_request.number }}
PR_PREVIEW_URL: https://qiskit.github.io/documentation/pr-${{ github.event.pull_request.number }}/
# Refer to https://yarnpkg.com/features/security#hardened-mode. We cannot enable this
# because the Dockerfile already has the dependencies pre-installed and eagerly
# validating the lockfile will miss the required auth token.
YARN_ENABLE_HARDENED_MODE: 0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: docker/login-action@v3
with:
registry: icr.io
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: Set up deployment status
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: pr_preview
ref: ${{ github.event.pull_request.head.ref }}
- name: Get all changed files
id: changed-files
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
CHANGED_FILES="$(node scripts/ci/determine-changed-files.ts "${{ github.event.number }}")"
{
echo "ALL_CHANGED_FILES<<__GH_OUTPUT__"
printf '%s\n' "$CHANGED_FILES"
echo "__GH_OUTPUT__"
} >> "$GITHUB_OUTPUT"
- name: Determine changed content files
env:
GH_TOKEN: ${{ github.token }}
CHANGED_FILES: ${{ steps.changed-files.outputs.ALL_CHANGED_FILES }}
# If changing these regexes, test them on https://regex101.com/ with the
# following paths (you can paste the block in and uncomment it):
# Add new tests if necessary
CONTENT_FILE_REGEX: (docs|learning)(?!\/api)\/.*\.(mdx|ipynb|json)
# -- Should match:
# docs/guides/thing.ipynb
# docs/guides/thing.mdx
# learning/courses/my-course/introduction.ipynb
# docs/guides/_toc.json
#
# -- Should not match:
# docs/api/qiskit/index.mdx
# scripts/nb-tester/example-notebook.ipynb
id: changed-content-files
run: |
CHANGED_CONTENT_FILES=$(echo "${CHANGED_FILES[@]}" | grep -P $CONTENT_FILE_REGEX || true)
mkdir -p .github/outputs
echo "Detected these changed content files:"
echo $CHANGED_CONTENT_FILES
echo $CHANGED_CONTENT_FILES >> .github/outputs/changed-content-files.txt
- name: Build static site
run: >
scripts/pr-previews/builder.py
${{ env.PR_PREVIEW_PATH }}
--basepath /documentation/${{ env.PR_PREVIEW_PATH }}
- name: Delete temp files
# Otherwise this gets pushed to the gh-pages branch
run: rm -r .github/outputs
- name: Deploy to GitHub Pages
run: scripts/pr-previews/deploy.py ${{ env.PR_PREVIEW_PATH }}
- name: Determine deployment result
run: scripts/pr-previews/poll_deployment.py ${{ env.PR_PREVIEW_URL }}
- name: Report deployment status
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
token: ${{ github.token }}
env: ${{ steps.deployment.outputs.env }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ env.PR_PREVIEW_URL }}
override: false