Basic Workflow Setup
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Basic Workflow Setup

  • Dark
    Light
  • PDF

Article summary

Adding workflows to your existing repos is easy. This example will show you how to add a repo that generates a bill of materials BOM from your project files.

The generate-bom Add-on works with Altium, Cadence, and System Capture files. If your ECAD tool isn't listed and you want to get started, please reach out to support@allspice.io

Add a new workflow file

Create a file in your repo .allspice/workflows/hello-world.yml

  1. Select your repository→Add File→New File

https://cdn.document360.io/3d44af5c-3f49-4ca5-b152-10836a885c13/Images/Documentation/image(73).png

  1. Add the path, then the filename .allspice/workflows/your-file-name.yml. The form will automatically move from folder to folder to file as shown in this gif:

new allspice file.gif

  1. Add a name to your workflow file.
name: Generate-BOM
  1. Add your Triggers to the workflow file.
# Triggers
on:
  push:
  issues:
    # Trigger on issue open, close, or reopen
    types: [opened, closed, reopened]
  1. Add a job and set runs-on to ubuntu-latest
jobs:
  Job-Hello-World:
    runs-on: ubuntu-latest
  1. Add steps: to signal the beginning of individual steps.
    steps:
  1. Add your first step, which calls the generate-bom Add-on. You can see the full list of customization in the generate-bom Add-on repo. This Add-on automatically creates a file with the default filename BOM.csv.
    - name: Generate BOM
      uses: https://hub.allspice.io/Actions/generate-bom@v0.5
      with:
        # The path to the project file in your repo.
        # .PrjPcb for Altium, .DSN for OrCad, .SDAX for System Capture.
        source_path: Archimajor.PrjPcb
        variant: ""
  1. Modify the source_path file to match your project file. If you're not sure, reach out to support@allspice.io. In this example the source_path file is Archimajor.PrjPcb.
        source_path: your-project-filename.PrjPcb
  1. Add a step to show the BOM in the run web interface. cat is a shell command that prints the file to the terminal.
     - name: Show BOM
         run: cat bom.csv
  1. Add a step to upload your BOM.csv as an Artifact file.
      - name: Upload file as artifact
          uses: actions/upload-artifact@v3
          with:
            name: BOM.csv
            path: bom.csv
  1. Here is the complete file.
name: Generate-BOM

# Triggers
on:
  push:
  issues:
    # Trigger on issue open, close, or reopen
    types: [opened, closed, reopened]

jobs:
![click on actions tab.gif](https://cdn.document360.io/3d44af5c-3f49-4ca5-b152-10836a885c13/Images/Documentation/click%20on%20actions%20tab.gif){height="" width=""}

  Job-Hello-World:
    runs-on: ubuntu-latest
    steps:
      - name: Generate BOM
        uses: https://hub.allspice.io/Actions/generate-bom@v0.5
        with:
          # The path to the project file in your repo.
          # .PrjPcb for Altium, .DSN for OrCad, .SDAX for System Capture.
          source_path: Archimajor.PrjPcb
          variant: ""

      - name: Show BOM
          run: cat bom.csv

      - name: Upload file as artifact
          uses: actions/upload-artifact@v3
          with:
            name: BOM.csv
            path: bom.csv
  1. Review the file then scroll down and click the “Commit Changes” button to commit the workflow file to the repository. You may add an optional commit message like "Add new workflow file".

paste workflow.gif

Trigger your first action

The example above should trigger an action as soon as you commit the files.

This workflow specifies that actions will trigger on push or issue open/close

To trigger this action again do one of the following:

  • Push changes to the repo
  • Open/New issue (This is the easiest to check)
  • Close an issue

View Actions results

Visit the Actions tab and see the list of workflow runs.

click on action tab loop.gif

Click on a workflow run.
click on action run links loop.gif

Explore the run by clicking on the Step toggles.
click on workflow step toggles.gif

Download the artifact by clicking the link on the left

download bom artifact and look at it.gif

view action runner clean.gif

To learn more about AllSpice Workflows, visit our Advanced Workflow Customization


Was this article helpful?