forked from PhotonVision/photonvision
-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (110 loc) · 3.16 KB
/
photon-code-docs.yml
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Photon Code Documentation
on:
# Run on pushes to master and pushed tags, and on pull requests against master, but ignore the docs folder
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
merge_group:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changed:
runs-on: ubuntu-22.04
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
docs: ${{ steps.filter.outputs.docs == 'true' || steps.filter.outputs.workflow == 'true' }}
code: ${{ steps.filter.outputs.code == 'true' || steps.filter.outputs.workflow == 'true' }}
steps:
- name: Check for file changes
uses: dorny/paths-filter@v2
id: filter
with:
list-files: 'shell'
filters: |
docs:
- 'docs/**'
workflow:
- '.github/**'
code:
- 'photon-*/**'
echo:
needs: changed
runs-on: ubuntu-22.04
steps:
- run: echo "code=${{ needs.changed.outputs.code }}"
- run: echo "docs=${{ needs.changed.outputs.docs }}"
build-client:
needs: changed
name: "PhotonClient Build"
if: needs.changed.outputs.code == 'true'
defaults:
run:
working-directory: photon-client
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: npm ci
- name: Build Production Client
run: npm run build-demo
- uses: actions/upload-artifact@v4
with:
name: built-client
path: photon-client/dist/
run_docs:
runs-on: "ubuntu-22.04"
needs: changed
if: needs.changed.outputs.code == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Build javadocs/doxygen
run: |
chmod +x gradlew
./gradlew photon-docs:generateJavaDocs photon-docs:doxygen
- uses: actions/upload-artifact@v4
with:
name: built-docs
path: photon-docs/build/docs
release:
needs: [build-client, run_docs]
runs-on: ubuntu-22.04
steps:
# Download literally every single artifact.
- uses: actions/download-artifact@v4
- run: find .
- name: copy file via ssh password
if: github.ref == 'refs/heads/master'
uses: appleboy/[email protected]
with:
host: ${{ secrets.WEBMASTER_SSH_HOST }}
username: ${{ secrets.WEBMASTER_SSH_USERNAME }}
password: ${{ secrets.WEBMASTER_SSH_KEY }}
port: ${{ secrets.WEBMASTER_SSH_PORT }}
source: "*"
target: /var/www/html/photonvision-docs/