forked from nasa/cFE
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (142 loc) · 5.4 KB
/
build-documentation.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: cFS Documentation and Guides Script
on:
push:
pull_request:
workflow_dispatch:
schedule:
# 10:45 PM UTC every Sunday
- cron: '45 22 * * 0'
jobs:
# Checks for duplicate actions. Skips push actions if there is a matching or
# duplicate pull-request action.
checks-for-duplicates:
runs-on: ${{ github.repository_owner == 'cFS' && 'linux' || 'ubuntu-latest' }}
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
checkout-and-cache:
name: Custom checkout and cache for cFS documents
needs: checks-for-duplicates
if: ${{ needs.checks-for-duplicates.outputs.should_skip != 'true' || contains(github.ref, 'main') }}
runs-on: ${{ github.repository_owner == 'cFS' && 'linux' || 'ubuntu-latest' }}
steps:
- name: Checkout bundle
uses: actions/checkout@v3
with:
repository: arielswalker/cFS
submodules: true
- name: Checkout submodule
uses: actions/checkout@v3
with:
path: cfe
- name: Cache Source and Build
id: cache-src-bld
uses: actions/cache@v3
with:
path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/*
key: cfs-doc-${{ github.run_number }}
build-cfe-usersguide:
needs: checkout-and-cache
name: Build and deploy cFE Docs
runs-on: ${{ github.repository_owner == 'cFS' && 'linux' || 'ubuntu-latest' }}
env:
TARGET: '["cfe-usersguide"]'
CACHE_KEY: "cfs-doc-${{ github.run_number }}"
DEPLOY: "false" # Note can't use cache with deploy, deploy in following job instead
BUILD_PDF: "${{ github.event_name == 'push' && contains(github.ref, 'main')}}"
APP_NAME: ""
NEEDS_OSAL_API: "true"
steps:
- name: Get cache if supplied
id: cache-src-bld
if: ${{ env.CACHE_KEY != '' }}
uses: actions/cache@v4
with:
path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/*
key: ${{ env.CACHE_KEY }}
- name: Checkout Repo
if: ${{ env.APP_NAME != '' }}
uses: actions/checkout@v4
with:
path: apps/${{ env.APP_NAME}}
- name: Run Build Document Script
run: |
chmod +x ./.github/scripts/build-deploy-doc.sh
./.github/scripts/build-deploy-doc.sh "$TARGET" "$CACHE_KEY" "$DEPLOY" "$BUILD_PDF" "$APP_NAME" "$NEEDS_OSAL_API"
- name: Archive Document Build Logs
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET }}_doc_build_logs
path: |
${{ env.TARGET }}_stdout.txt
${{ env.TARGET }}_stderr.txt
${{ env.TARGET }}-warnings.log
${{ env.TARGET }}.pdf
build-mission-doc:
needs: checkout-and-cache
name: Build Mission Doc
runs-on: ${{ github.repository_owner == 'cFS' && 'linux' || 'ubuntu-latest' }}
env:
TARGET: '["mission-doc"]'
CACHE_KEY: "cfs-doc-${{ github.run_number }}"
DEPLOY: "false"
BUILD_PDF: "false" # No need for mission pdf within cFE, done at bundle level
APP_NAME: ""
NEEDS_OSAL_API: "true"
steps:
- name: Get cache if supplied
id: cache-src-bld
if: ${{ env.CACHE_KEY != '' }}
uses: actions/cache@v4
with:
path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/*
key: ${{ env.CACHE_KEY }}
- name: Checkout Bundle Main
uses: actions/checkout@v4
with:
submodules: true
repository: arielswalker/cFS
- name: Checkout Repo
if: ${{ env.APP_NAME != '' }}
uses: actions/checkout@v4
with:
path: apps/${{ env.APP_NAME}}
- name: Run Build Document Script
run: |
chmod +x ./.github/scripts/build-deploy-doc.sh
./.github/scripts/build-deploy-doc.sh "$TARGET" "$CACHE_KEY" "$DEPLOY" "$BUILD_PDF" "$APP_NAME" "$NEEDS_OSAL_API"
- name: Archive Document Build Logs
uses: actions/upload-artifact@v4
with:
name: ${{ env.TARGET }}_doc_build_logs
path: |
${{ env.TARGET }}_stdout.txt
${{ env.TARGET }}_stderr.txt
${{ env.TARGET }}-warnings.log
${{ env.TARGET }}.pdf
deploy-documentation:
needs: build-cfe-usersguide
if: ${{ github.event_name == 'push' && contains(github.ref, 'main')}}
name: Deploy documentation to gh-pages
runs-on: ${{ github.repository_owner == 'cFS' && 'linux' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Move pdfs to deployment directory
run: mkdir deploy; mv */*.pdf deploy
- name: Deploy to GitHub
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: deploy
SINGLE_COMMIT: true