Skip to content

Commit 4939eb6

Browse files
committed
Made it a KiCad plugin
1 parent 2f8971e commit 4939eb6

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

.github/workflows/release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
prepare:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version: ${{ steps.extract_metadata.outputs.version }}
12+
identifier: ${{ steps.extract_metadata.outputs.identifier }}
13+
status: ${{ steps.extract_metadata.outputs.status }}
14+
kicad_version: ${{ steps.extract_metadata.outputs.kicad_version }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Extract metadata
20+
id: extract_metadata
21+
run: |
22+
# Extract version and remove 'v' prefix if present
23+
VERSION_WITHOUT_V=${{ github.ref_name }}
24+
VERSION_WITHOUT_V=${VERSION_WITHOUT_V#v}
25+
26+
# Extract metadata from JSON
27+
IDENTIFIER=$(jq -r '.identifier' metadata.json)
28+
STATUS=$(jq -r '.versions[0].status' metadata.json)
29+
KICAD_VERSION=$(jq -r '.versions[0].kicad_version' metadata.json)
30+
31+
echo "version=$VERSION_WITHOUT_V" >> $GITHUB_OUTPUT
32+
echo "identifier=$IDENTIFIER" >> $GITHUB_OUTPUT
33+
echo "status=$STATUS" >> $GITHUB_OUTPUT
34+
echo "kicad_version=$KICAD_VERSION" >> $GITHUB_OUTPUT
35+
36+
build:
37+
needs: prepare
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: write
41+
outputs:
42+
download_url: ${{ steps.upload_archive.outputs.download_url }}
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v3
46+
47+
- name: Update version in metadata.json
48+
run: |
49+
# Update version in metadata.json
50+
jq --arg ver "${{ needs.prepare.outputs.version }}" '.versions[0].version = $ver' metadata.json > metadata.json.tmp
51+
mv metadata.json.tmp metadata.json
52+
53+
- name: Create ZIP archive
54+
id: create_archive
55+
run: |
56+
ARCHIVE_NAME=skt-${{ github.ref_name }}.zip
57+
echo "archive_name=$ARCHIVE_NAME" >> $GITHUB_OUTPUT
58+
59+
zip -r "$ARCHIVE_NAME" \
60+
kicad-templates/ \
61+
metadata.json \
62+
-x "*.git*" -x "*.github*"
63+
64+
- name: Upload archive to release
65+
id: upload_archive
66+
env:
67+
GH_TOKEN: ${{ github.token }}
68+
run: |
69+
gh release upload ${{ github.ref_name }} ${{ steps.create_archive.outputs.archive_name }} --clobber
70+
71+
# Get the download URL for the uploaded asset
72+
DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ steps.create_archive.outputs.archive_name }}"
73+
echo "download_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
74+
75+
add_to_index:
76+
needs: [prepare, build]
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Trigger PCM Index workflow
80+
uses: benc-uk/workflow-dispatch@v1
81+
with:
82+
workflow: add-plugin-version.yml
83+
repo: sivakov512/kicad-pcm-index
84+
ref: master
85+
token: ${{ secrets.PCM_INDEX_TOKEN }}
86+
inputs: |
87+
{
88+
"identifier": "${{ needs.prepare.outputs.identifier }}",
89+
"version": "${{ needs.prepare.outputs.version }}",
90+
"status": "${{ needs.prepare.outputs.status }}",
91+
"kicad_version": "${{ needs.prepare.outputs.kicad_version }}",
92+
"download_url": "${{ needs.build.outputs.download_url }}"
93+
}

metadata.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://go.kicad.org/pcm/schemas/v1",
3+
"name": "Sivakov KiCad template collection",
4+
"description": "KiCad templates optimized for PCB manufacturing services.",
5+
"description_full": "A collection of KiCad PCB templates optimized for PCB manufacturing. Templates include preconfigured design rules and stackups to meet specific manufacturing requirements and specifications.",
6+
"identifier": "com.github.sivakov512.kicad-templates",
7+
"type": "library",
8+
"author": {
9+
"name": "Nikita Sivakov",
10+
"contact": {
11+
"github": "https://github.com/sivakov512",
12+
"email": "sivakov512@icloud.com"
13+
}
14+
},
15+
"license": "MIT",
16+
"resources": {
17+
"homepage": "https://github.com/sivakov512/kicad-templates"
18+
},
19+
"tags": ["jlcpcb", "library", "pcb", "template"],
20+
"versions": [
21+
{
22+
"version": "1.0.0",
23+
"status": "stable",
24+
"kicad_version": "8.0"
25+
}
26+
]
27+
}

0 commit comments

Comments
 (0)