-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (47 loc) · 1.45 KB
/
kicad-revs.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
on:
pull_request:
types:
- opened
- synchronize
name: KiCad Revision Update
jobs:
kicad-update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Get release directory
id: changed-files
uses: tj-actions/changed-files@v44
with:
dir_names: true
files: |
**/CHANGELOG.md
json: true
- name: Update KiCad revisions
run: |
cat <<EOF
${{ steps.changed-files.outputs.all_changed_files }}
EOF
PROJECT_DIR="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | jq -r '.[0]')"
VERSION="$(echo $TITLE | awk '{print $NF}')"
if [ -z "$VERSION" ]; then
echo "No version found in PR title, skipping"
exit
fi
if [ -z "$PROJECT_DIR" ]; then
echo "No project dir found, skipping"
exit
fi
# Update the revision in the KiCad files
find "$PROJECT_DIR" -regextype egrep -regex ".*\.kicad_(sch|pcb)" -print -exec sed -i "s/(rev \".*\"/(rev \"v$VERSION\"/" {} \;
env:
TITLE: ${{ github.event.pull_request.title }}
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actor
message: "chore: update KiCad revisions"