-
Notifications
You must be signed in to change notification settings - Fork 81
72 lines (66 loc) · 2.34 KB
/
pr-preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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/**/*"
- "public/images/**/*"
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 }}/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- 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: Build static site
run: >
scripts/pr_previews/builder.py
${{ env.PR_PREVIEW_PATH }}
--basepath /documentation/${{ env.PR_PREVIEW_PATH }}
- 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