forked from circuitdiagram/components
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.2 KB
/
ci.yml
File metadata and controls
83 lines (72 loc) · 2.2 KB
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
81
82
83
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Circuit Diagram CLI
run: |
curl -L -o circuit-diagram-cli.tar.gz https://github.com/circuitdiagram/circuitdiagram/releases/download/v4.0.2-pre.20/circuit-diagram-cli.4.0.2-pre.20.linux-x64.tar.gz
tar -xJf circuit-diagram-cli.tar.gz
- name: Build
run: |
mkdir ./build
./circuit-diagram-cli component ./ --components ./ --recursive -o ./build --format binary svg --manifest ./build/manifest.xml --all-configurations
- name: Lint
shell: pwsh
run: ./lint.ps1
- uses: actions/upload-artifact@v4
with:
name: manifest
path: build/manifest.xml
- uses: actions/upload-artifact@v4
with:
name: previews
path: build/*.svg
Publish:
runs-on: windows-latest
if: github.ref == 'refs/heads/master'
needs:
- Build
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
name: manifest
path: build
- name: Download CLI
shell: pwsh
run: |
Invoke-WebRequest -Uri ${{ secrets.COMPONENT_REGISTRY_CLI_URL }} -OutFile ComponentRegistryCli.zip
Expand-Archive ComponentRegistryCli.zip -DestinationPath .
- name: Publish
env:
COMPONENT_REGISTRY_AUTH_TOKEN: ${{ secrets.COMPONENT_REGISTRY_AUTH_TOKEN }}
shell: pwsh
run: |
[xml]$manifest = Get-Content "build/manifest.xml"
foreach ($component in $manifest.components.component)
{
./ComponentRegistryCli.exe publish -f circuitdiagram $component.input
if ($lastExitCode)
{
exit $lastExitCode
}
}
foreach ($configuration in ($manifest.components.component.configuration | Where-Object{$_.input -And $_.input.endswith(".yaml")}))
{
./ComponentRegistryCli.exe publish -f circuitdiagram $configuration.input
if ($lastExitCode)
{
exit $lastExitCode
}
}