Gautam Peri f435058db1
All checks were successful
Generate Schematic PDFs / generate-schematic-pdfs (push) Successful in 13s
Adding initial README
2025-05-28 19:58:22 +00:00

72 lines
3.7 KiB
Markdown

# Generate OrCAD Schematic PDF Actions Demo
This repository demonstrates the "Generate OrCAD Schematic PDF Actions" AllSpice Actions add-on.
The workflow showcased uses the [generate-orcad-schematic-pdf](https://hub.allspice.io/Actions/generate-orcad-schematic-pdf) Actions add-on, publically available in the [AllSpice Hub Actions](https://hub.allspice.io/Actions) organization.
In typical workflows, the generate-orcad-schematic-pdf add-on is used to generate a PDF from any OrCAD .dsn files that are pushed to AllSpice in a commit, and then commit the generated PDFs in the accompanying folder locations of the design files they correspond to. This option can be omitted to just leave a PDF zip file artifact in the action run.
Another useful option is for title block annotation with the AllSpice commit and the committing user added to a selected field inside the title block. This allows users to trace the PDF back to the commit which generated it, keeping a 1-1 parity between design and design artifact.
## Usage
### Step 1) Generate a personal access token
This add-on requires a personal access token stored as Actions secret. Refer to the [knowledge base article on Actions secrets](https://learn.allspice.io/docs/secrets#actions-secrets) to learn how to add the required secret to your repository.
![Repository Secrets](./images/repository_secrets.png)
In this example the personal access token is stored as PAT and passed as input to the action as demonstrated below:
### Step 2) Add the following step to your actions:
```yaml
name: Generate Schematic PDFs
on:
push:
jobs:
generate-schematic-pdfs:
runs-on: ubuntu-latest
steps:
# Check out repository code
- name: "[📚->🖥️] Check out repository code"
uses: actions/checkout@v3
- name: "[🔎->📂] List files in repo 🔎"
run: |
ls -la ${{ allspice.workspace }}
- name: Generate OrCAD Schematic PDF
uses: https://hub.allspice.io/Actions/generate-orcad-schematic-pdf.git@v0.1
with:
# The AllSpice repository that triggered this action
repository: ${{ allspice.repository }}
# The name of the branch that triggered this action
ref: ${{ allspice.head_ref || allspice.ref_name }}
# The commit hash that triggered this action
sha: ${{ allspice.sha }}
# Name of the title block field to annotate with the AllSpice commit
title_block_field: "Title"
# Set this to true to commit back to the origin branch of the design file
commit_to_branch: "True"
# An auth token / personal access token with write permissions
auth_token: ${{ secrets.PAT }}
# Archive the PDFs zip file as an artifact file
- name: Archive generated PDFs
uses: actions/upload-artifact@v3
with:
name: pdfs.zip
path: pdfs.zip
```
### Step 3) Customize the action with Title Block Annotation
The `title_block_field` option shown above provides a way to inform the Action of the name of the field inside a title block to annotate the corresponding AllSpice commit for the design update that triggered this Action. As seen in the above example, using the "title" field annotates the title field inside the title block with a clickable commit ID and the user who made that commit:
![Title Block Annotation](./images/title_block_annotation.png)
### Step 4) Set the option to commit to branch
The `commit_to_branch` option shown above informs the Action whether the generated PDF should be committed back to the same branch and directory location of the design file update that triggered this Action. The expected values are "True" or "False" in double quotes as a string input.