@@ -63,144 +63,3 @@ jobs:
6363 uses : softprops/action-gh-release@v2
6464 with :
6565 files : pfSense-${{ matrix.PFSENSE_VERSION }}-pkg-RESTAPI.pkg
66-
67- build_schemas :
68- runs-on : self-hosted
69- needs : [release_pkg]
70- steps :
71- - uses : actions/checkout@v4
72-
73- - uses : actions/download-artifact@v4
74- with :
75- name : pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-pkg-RESTAPI.pkg
76- path : pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-pkg-RESTAPI.pkg
77-
78- - name : Setup pfSense VM
79- run : |
80- /usr/local/bin/VBoxManage controlvm pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE poweroff || true
81- /usr/local/bin/VBoxManage snapshot pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE restore initial
82- /usr/local/bin/VBoxManage startvm pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE --type headless
83- sleep 5
84-
85- # This is only necessary until GitHub Actions allows an easier way to get a URL to download the artifact within pfSense
86- - name : Copy pfSense-pkg-RESTAPI build to pfSense
87- run : |
88- pfsense-vshell --host pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com -u admin -p pfsense -c 'pfSsh.php playback enablesshd' -k
89- pfsense-vshell --host pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com -u admin -p pfsense -c "mkdir /root/.ssh/ && echo $(cat ~/.ssh/id_rsa.pub) > /root/.ssh/authorized_keys" -k
90- scp -o StrictHostKeyChecking=no pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-pkg-RESTAPI.pkg/pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-pkg-RESTAPI.pkg admin@pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com:/tmp/
91-
92- - name : Install pfSense-pkg-RESTAPI on pfSense
93- run : |
94- ssh -o StrictHostKeyChecking=no -o LogLevel=quiet admin@pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com "pkg -C /dev/null add /tmp/pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-pkg-RESTAPI.pkg"
95- sleep 5
96-
97- - name : Fetch schemas from pfSense
98- run : |
99- curl -s -k -u admin:pfsense -X GET https://pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com/api/v2/schema/openapi > openapi.json
100- curl -s -k -u admin:pfsense -X GET https://pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE.jaredhendrickson.com/api/v2/schema/graphql > schema.graphql
101-
102- - name : Teardown pfSense VM
103- if : " ${{ always() }}"
104- run : |
105- /usr/local/bin/VBoxManage controlvm pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE poweroff || true
106- /usr/local/bin/VBoxManage snapshot pfSense-${{ env.DEFAULT_PFSENSE_VERSION }}-RELEASE restore initial
107-
108- - name : Upload OpenAPI schema
109- uses : actions/upload-artifact@v4
110- with :
111- name : openapi.json
112- path : openapi.json
113-
114- - name : Upload GraphQL schema
115- uses : actions/upload-artifact@v4
116- with :
117- name : schema.graphql
118- path : schema.graphql
119-
120- release_docs :
121- needs : [build_schemas]
122- runs-on : ubuntu-latest
123- if : ${{ !github.event.release.prerelease }}
124- environment :
125- name : github-pages
126- url : ${{ steps.deployment.outputs.page_url }}
127- steps :
128- - uses : actions/checkout@v4
129-
130- - name : Setup Pages
131- uses : actions/configure-pages@v5.0.0
132-
133- - name : Make website directory
134- run : mkdir ./www
135-
136- - name : Setup python
137- uses : actions/setup-python@v5
138- with :
139- python-version : ${{ env.PYTHON_VERSION }}
140-
141- - name : Build mkdocs site
142- run : |
143- python3 -m pip install -r ./requirements.txt
144- python3 -m mkdocs build
145- mv ./site/* ./www/
146-
147- - name : Download OpenAPI schema
148- uses : actions/download-artifact@v4
149- with :
150- name : openapi.json
151- path : openapi.json
152-
153- - name : Download GraphQL schema
154- uses : actions/download-artifact@v4
155- with :
156- name : schema.graphql
157- path : schema.graphql
158-
159- - name : Build Swagger UI
160- run : |
161- mkdir -p ./www/api-docs/
162- wget -O /tmp/swagger.tar.gz https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${{ env.SWAGGER_UI_VERSION }}.tar.gz
163- tar -xzf /tmp/swagger.tar.gz -C /tmp/
164- cp -r /tmp/swagger-ui-${{ env.SWAGGER_UI_VERSION }}/dist/* ./www/api-docs/
165- cp pfSense-pkg-RESTAPI/files/usr/local/www/api/swagger/index.css ./www/api-docs/index.css
166- cp openapi.json/openapi.json ./www/api-docs/openapi.json
167- echo 'window.onload = function() {
168- document.title = "pfSense REST API Documentation";
169- window.ui = SwaggerUIBundle({
170- url: "/api-docs/openapi.json",
171- dom_id: "#swagger-ui",
172- deepLinking: true,
173- presets: [
174- SwaggerUIBundle.presets.apis,
175- SwaggerUIStandalonePreset
176- ],
177- plugins: [
178- SwaggerUIBundle.plugins.DownloadUrl
179- ],
180- layout: "StandaloneLayout",
181- supportedSubmitMethods: [],
182- validatorUrl: null
183- });
184- };' > ./www/api-docs/swagger-initializer.js
185-
186- - name : Write GraphQL schema
187- run : |
188- mkdir -p ./www/graphql-docs/
189- cp schema.graphql/schema.graphql ./www/graphql-docs/schema.graphql
190-
191- - name : Build PHP reference documentation
192- run : |
193- mkdir ./www/php-docs
194- wget https://phpdoc.org/phpDocumentor.phar
195- chmod +x phpDocumentor.phar
196- ./phpDocumentor.phar
197- mv ./.phpdoc/build/* ./www/php-docs/
198-
199- - name : Upload artifact
200- uses : actions/upload-pages-artifact@v3.0.1
201- with :
202- path : " ./www"
203-
204- - name : Deploy to GitHub Pages
205- id : deployment
206- uses : actions/deploy-pages@v4.0.5
0 commit comments