generated from bob-swinkels/KiCad-Project-Skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (70 loc) · 3.38 KB
/
gen_schematic_outputs.yaml
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
73
74
75
76
77
78
79
80
# This workflow generates documentation (PDFs, interactive BOMs, board images). The
# The version number and date of the design is automatically updated in the schematic
# file and on the PCB. The version number is set via an environment variable
# and by default is `pre-release` since this runs outside of the release process
# so there's no formal release number to use.
# To use this workflow in your own repo you need to edit the timezone in the environment variables in the env: section
# below.
name: "KiBot - Generate Schematic Outputs"
on:
workflow_dispatch:
inputs:
version:
description: "Design version"
required: true
default: "pre-release"
jobs:
Documentation:
env:
# Set this to your local timezone. See https://www.wikiwand.com/en/List_of_tz_database_time_zones for valid strings.
Timezone: Europe/Amsterdam
# Set this to the output folder for all of the generated files. Unless you have a very
# good reason to change this you should leave it as KiBotOutput.
OutputFolder: KiBotOutput
# Set this to the version to include in the schematic and PCB. Since this
# script runs outside of the release process it can't pull a version
# number automatically from GitHub.
Version: pre-release
runs-on: ubuntu-latest
# These are all the steps that generate the files.
steps:
# Check out the files
- uses: actions/checkout@v2
# Get the base project name
- name: Get KiCad project name
id: project_name
run: echo "::set-output name=project_name::$(find ./pcb/kicad_project -iname *.pro -execdir basename {} .pro ';')"
# Get the current date
- name: Get current date
id: date
run: echo "::set-output name=date::$(TZ='${{ env.Timezone }}' date +'%Y-%m-%d')"
# Do a string replacement in the schematic file to set the version and date.
# Any instance of %%version%% in the schematic gets replaced with the release version.
# Any instance of %%date%% in the schematic gets replaced with the release date.
- name: Set schematic version
uses: jacobtomlinson/gha-find-replace@master
with:
include: "pcb/kicad_project/*.sch"
find: "%%version%%"
replace: ${{ github.event.inputs.version }}
- name: Set schematic date
uses: jacobtomlinson/gha-find-replace@master
with:
include: "pcb/kicad_project/*.sch"
find: "%%date%%"
replace: ${{ steps.date.outputs.date }}
# Actually run KiBot to generate all the files. The KiBot script used is
# in the 1_pcb/.kibot/release.kibot.yaml folder.
- name: Generate schematic documentation
uses: INTI-CMNB/KiBot@3acaa425740658045e0f1ecda7220e7dc6f7d2e3
with:
config: pcb/.kibot/schematic_outputs.kibot.yaml
dir: ${{ env.OutputFolder }}
schema: pcb/kicad_project/${{ steps.project_name.outputs.project_name }}.sch
board: pcb/kicad_project/${{ steps.project_name.outputs.project_name }}.kicad_pcb
# Archive all the artifacts from output and attach to the action's results.
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.project_name.outputs.project_name }}-${{ github.event.inputs.version }}-${{ steps.date.outputs.date }}
path: ${{ env.OutputFolder }}/**