1
+ name : NDK build
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ tags :
7
+ - " v*"
8
+ branches :
9
+ - ' master'
10
+ - ' dev/*'
11
+ - ' feat/*'
12
+ - ' fix/*'
13
+ paths-ignore :
14
+ - ' **.yml'
15
+ - ' !.github/workflows/build-ndk.yml'
16
+ - ' **.json'
17
+ - ' !qpm.json'
18
+ - ' !qpm.shared.json'
19
+ - ' !mod.template.json'
20
+ - ' **.txt'
21
+ - ' !CMakeLists.txt'
22
+ - ' **.ps1'
23
+ - ' !build.ps1'
24
+ - ' !createqmod.ps1'
25
+ - ' **.md'
26
+ - ' .gitignore'
27
+ pull_request :
28
+ branches : master
29
+
30
+ env :
31
+ module_id : songchartvisualizer
32
+ qmod_name : SongChartVisualizer
33
+
34
+ jobs :
35
+ build :
36
+ runs-on : ubuntu-latest
37
+ env :
38
+ WEBHOOK : ${{ secrets.DISCORD_WEBHOOK }}
39
+
40
+ steps :
41
+ - uses : FranzDiebold/github-env-vars-action@v2
42
+ - uses : actions/checkout@v2
43
+ name : Checkout
44
+ with :
45
+ submodules : true
46
+ lfs : true
47
+
48
+ - uses : seanmiddleditch/gha-setup-ninja@v3
49
+
50
+ # Use canary NDK to avoid lesser known compile bugs
51
+ - name : Setup canary NDK
52
+ id : setup-ndk
53
+ uses : ./.github/actions/canary-ndk
54
+
55
+ - name : Create ndkpath.txt
56
+ run : |
57
+ echo ${{ steps.setup-ndk.outputs.ndk-path }} > ${GITHUB_WORKSPACE}/ndkpath.txt
58
+ cat ${GITHUB_WORKSPACE}/ndkpath.txt
59
+
60
+ # get version from pushed tag
61
+ - name : Extract version
62
+ if : startsWith(github.ref, 'refs/tags/v')
63
+ id : version
64
+ run : |
65
+ echo "TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
66
+ echo "VERSION=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT}
67
+
68
+ # if we don't have a tag, don't do anything special
69
+ - name : Setup qpm
70
+ if : ${{ !startsWith(github.ref, 'refs/tags/v') }}
71
+ uses : Fernthedev/qpm-action@main
72
+ with :
73
+ workflow_token : ${{ secrets.GITHUB_TOKEN }}
74
+ restore : true
75
+ cache : true
76
+ publish : false
77
+
78
+ # if we have a tag, we are making a qpm release
79
+ - name : Setup qpm for release
80
+ if : startsWith(github.ref, 'refs/tags/v')
81
+ uses : Fernthedev/qpm-action@main
82
+ with :
83
+ workflow_token : ${{ secrets.GITHUB_TOKEN }}
84
+ restore : true
85
+ cache : true
86
+ publish : true
87
+ publish_token : ${{ secrets.QPM_KEY }}
88
+ version : ${{ steps.version.outputs.VERSION }}
89
+ tag : ${{ steps.version.outputs.TAG }}
90
+ qpm_release_bin : true
91
+ qpm_debug_bin : true
92
+ qpm_qmod : ${{ env.qmod_name }}.qmod
93
+
94
+ - name : Build & Create Qmod
95
+ run : |
96
+ cd ${GITHUB_WORKSPACE}
97
+ qpm qmod zip
98
+
99
+ - name : Get Library Name
100
+ id : libname
101
+ run : |
102
+ cd ./build/
103
+ pattern="lib${module_id}*.so"
104
+ files=( $pattern )
105
+ echo "NAME=${files[0]}" >> ${GITHUB_OUTPUT}
106
+
107
+ - name : Rename debug artifact
108
+ run : mv "./build/debug/${{ steps.libname.outputs.NAME }}" "./build/debug_${{ steps.libname.outputs.NAME }}"
109
+
110
+ - name : Upload non-debug artifact
111
+ uses : actions/upload-artifact@v2
112
+ with :
113
+ name : ${{ steps.libname.outputs.NAME }}
114
+ path : ./build/${{ steps.libname.outputs.NAME }}
115
+ if-no-files-found : error
116
+
117
+ - name : Upload non-debug artifact to discord
118
+ if : " ${{ env.WEBHOOK != '' }}"
119
+
120
+ with :
121
+ webhook-url : ${{ env.WEBHOOK }}
122
+ content : " ${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`"
123
+ username : " ${{ github.repository }}"
124
+ avatar-url : " http://github.com/${{ env.CI_ACTOR }}.png"
125
+ filename : ./build/${{ steps.libname.outputs.NAME }}
126
+
127
+ - name : Upload debug artifact
128
+ uses : actions/upload-artifact@v2
129
+ with :
130
+ name : debug_${{ steps.libname.outputs.NAME }}
131
+ path : ./build/debug_${{ steps.libname.outputs.NAME }}
132
+ if-no-files-found : error
133
+
134
+ - name : Upload debug artifact to discord
135
+ if : " ${{ env.WEBHOOK != '' }}"
136
+
137
+ with :
138
+ webhook-url : ${{ env.WEBHOOK }}
139
+ content : " ${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`"
140
+ username : " ${{ github.repository }}"
141
+ avatar-url : " http://github.com/${{ env.CI_ACTOR }}.png"
142
+ filename : ./build/debug_${{ steps.libname.outputs.NAME }}
143
+
144
+ - name : Upload qmod artifact
145
+ uses : actions/upload-artifact@v2
146
+ with :
147
+ name : ${{env.qmod_name}}.qmod
148
+ path : ./${{ env.qmod_name }}.qmod
149
+ if-no-files-found : error
150
+
151
+ - name : Upload qmod artifact to discord
152
+ if : " ${{ env.WEBHOOK != '' }}"
153
+
154
+ with :
155
+ webhook-url : ${{ env.WEBHOOK }}
156
+ content : " ${{ env.CI_SHA_SHORT }} - `${{ github.event.head_commit.message }}`"
157
+ username : " ${{ github.repository }}"
158
+ avatar-url : " http://github.com/${{ env.CI_ACTOR }}.png"
159
+ filename : ./build/${{ steps.libname.outputs.NAME }}
160
+
161
+ # if we had a tag, we should make a release
162
+ - name : Upload release artifacts
163
+ if : startsWith(github.ref, 'refs/tags/v')
164
+ id : upload_file_release
165
+
166
+ with :
167
+ tag_name : ${{ github.event.inputs.version }}
168
+ files : |
169
+ ./build/${{ steps.libname.outputs.NAME }}
170
+ ./build/debug_${{ steps.libname.outputs.NAME }}
171
+ ./${{ env.qmod_name }}.qmod
172
+ env :
173
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
174
+
175
+ - name : Notify webhook
176
+ if : ${{ env.WEBHOOK != '' && startsWith(github.ref, 'refs/tags/v') }}
177
+
178
+ with :
179
+ webhook-url : ${{ env.WEBHOOK }}
180
+ content : " New Release published: `${{ steps.get_tag_version.outputs.TAG }}`"
181
+ username : " ${{ github.repository }}"
182
+ avatar-url : " http://github.com/${{ env.CI_ACTOR }}.png"
0 commit comments