-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (127 loc) · 4.39 KB
/
ci.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
name: New CI flow for Climb OBC Software
on:
push:
branches: [ develop ]
paths-ignore:
- '.github/**'
release:
types: [created]
workflow_dispatch:
jobs:
prepBuild:
runs-on: ubuntu-latest
name: Prepare Build Variables
outputs:
obcVersion: ${{ steps.create_ver.outputs.THE_SWVERSION }}
obcVersion2: ${{ steps.create_ver.outputs.MY_SWVERSION }}
steps:
- id: create_ver
name: Set Variables
run: |
THE_SWVERSION=$(printf '%.8s' "${{ github.sha }}" )
MY_SWVERSION=$(printf '%.10s' "$GITHUB_REF_NAME" )
#echo "THE_SWVERSION=$THE_SWVERSION" >> $GITHUB_ENV
#echo "MY_SWVERSION=$MY_SWVERSION" >> $GITHUB_ENV
echo "THE_SWVERSION=$THE_SWVERSION" >> "$GITHUB_OUTPUT"
echo "MY_SWVERSION=$MY_SWVERSION" >> "$GITHUB_OUTPUT"
echo "jobs output obcVersion set to '$THE_SWVERSION'"
echo "jobs output obcVersion2 set to '$MY_SWVERSION''"
buildDoc:
runs-on: ubuntu-latest
needs: prepBuild
name: Build the Documentation
steps:
- uses: actions/checkout@v3
- name: Replace MD tokens
env:
OBC_VERSION: ${{needs.prepBuild.outputs.obcVersion2}}
run: |
ESCAPED_REPLACE=$(printf '%s\n' "${{ github.ref }}" | sed -e 's/[\/&]/\\&/g')
find doc/*.md -type f -exec sed -i "s/@TKN_COMMIT_ID@/$ESCAPED_REPLACE/g" {} \;
find doc/*.md -type f -exec sed -i "s/@TKN_VERSION@/${{ github.sha }}/g" {} \;
find doc/*.md -type f -exec sed -i "s/@TKN_RELEASE@/${{ env.OBC_VERSION }}/g" {} \;
- name: Show replacement resut
run: cat doc/back.md
- name: Publish PDF Document
uses: RobertK66/actions-document-publish@79b8e666c0f531c297a98eee730d3fdecccde9f3
id: publish-pdf
with:
sources: 'doc/front.md doc/m*.md doc/back.md'
images_dir: doc/pic
image_import: pic
- name: rename the pdf file
env:
OBC_VERSION: ${{needs.prepBuild.outputs.obcVersion2}}
run: |
cp ${{ steps.publish-pdf.outputs.pdf }} ClimbObcManual_${{ env.OBC_VERSION }}.pdf
ls
- name: Upload Document
uses: actions/upload-artifact@v3
id: upload-axf
with:
name: 'BuildResult'
path: ./*.pdf
if-no-files-found: error
- name: Upload Tools
uses: actions/upload-artifact@v3
with:
name: 'BuildResult'
path: ./tool/FlashOBC.bat
if-no-files-found: error
buildIt:
runs-on: ubuntu-latest
needs: prepBuild
name: Build the Software artefacts
strategy:
matrix:
kind: ['obc', 'dev']
include:
- kind: obc
board: BA_CLIMBOBC
- kind: dev
board: BA_OM13085_EM2T
steps:
- env:
OBC_VERSION: ${{needs.prepBuild.outputs.obcVersion2}}
name: simulate build
run: |
echo "$OBC_VERSION"
echo dummy build creating result ...
echo "dummy content for ${{ matrix.kind }}"
echo "dummy content for ${{ matrix.kind }}" >> ./ClimbObc${{ env.OBC_VERSION }}-${{ matrix.kind }}.axf
pwd
ls
- name: Upload Binary
env:
MY_SWVERSION: ${{needs.prepBuild.outputs.obcVersion2}}
uses: actions/upload-artifact@v3
id: upload-axf
with:
name: 'BuildResult'
path: ClimbObc${{ env.MY_SWVERSION }}-${{ matrix.kind }}.axf
if-no-files-found: error
releaseJob:
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
needs: [ prepBuild, buildIt, buildDoc ]
steps:
- name: Download all the build files
uses: actions/download-artifact@v3
with:
name: 'BuildResult'
path: ./
- name: show path
run: |
ls
zip artefacts.zip *.*
ls
- name: upload reelese assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
OBC_VERSION: ${{needs.prepBuild.outputs.obcVersion2}}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artefacts.zip
asset_name: Release${{ env.OBC_VERSION }}.zip
asset_content_type: application/zip