Skip to content

💚 (#595): Changed the syntax for the quotes error #606

💚 (#595): Changed the syntax for the quotes error

💚 (#595): Changed the syntax for the quotes error #606

Workflow file for this run

name: Build PR preview
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true
jobs:
build-preview:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build
# builds to "site" directory by default
run: |
mkdocs build -f mkdocs.yml -d site
- name: Save built site
run: |
mkdir -p ./pr_site
mv site ./pr_site/.
- uses: actions/upload-artifact@v3
with:
name: pr_site
path: pr_site/
deploy-preview:
needs: build-preview
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: "Download built site"
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_site"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr_site.zip', Buffer.from(download.data));
- run: unzip pr_site.zip
- name: Deploy preview
uses: access-nri/[email protected]
with:
source-dir: site
action: deploy
pr-number: ${{ github.event.number }}
close-preview:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Clean preview
uses: access-nri/[email protected]
with:
action: remove
pr-number: ${{ github.event.number }}