|
1 | 1 | name: Deploy |
2 | 2 | on: |
3 | | - # Build on commits pushed, except when explicitly skipped. |
4 | | - push: |
5 | | - branches-ignore: |
6 | | - - 'no-ci-**' |
7 | | - - 'skip-ci-**' |
8 | | - # Build on pull requests, except drafts. |
9 | | - pull_request: |
10 | | - # Build manually |
11 | | - workflow_dispatch: |
| 3 | + workflow_run: |
| 4 | + workflows: |
| 5 | + - Build |
| 6 | + types: |
| 7 | + - completed |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +permissions: |
| 12 | + actions: read |
| 13 | + contents: read |
12 | 14 |
|
13 | 15 | env: |
14 | | - # Common settings. |
15 | | - CMAKE_VERSION: 3.25.x |
16 | | - # Common paths. |
17 | 16 | ci_source_dir: ${{ github.workspace }}/source-code |
18 | 17 | ci_build_script: ./source-code/Script/ci_build.sh |
19 | | - ci_build_dir: ${{ github.workspace }}/cmake-build |
20 | | - ci_native_sdk_dir: ${{ github.workspace }}/SDK-native |
| 18 | + ci_web_build_dir: ${{ github.workspace }}/web-build |
| 19 | + ci_windows_build_dir: ${{ github.workspace }}/windows-build |
21 | 20 | ci_target_sdk_dir: ${{ github.workspace }}/SDK-target |
22 | 21 |
|
23 | 22 | defaults: |
24 | 23 | run: |
25 | 24 | shell: bash |
26 | 25 |
|
27 | 26 | jobs: |
28 | | - CheckSkipCI: |
| 27 | + Deploy: |
29 | 28 | runs-on: ubuntu-latest |
30 | 29 | if: | |
31 | | - !contains(github.event.head_commit.message, '[skip ci]') && |
32 | | - !contains(github.event.pull_request.title, '[skip ci]') && |
33 | | - !contains(github.event.head_commit.message, '[skip-ci]') && |
34 | | - !contains(github.event.pull_request.title, '[skip-ci]') |
35 | | - steps: |
36 | | - - run: exit 0 |
37 | | - |
38 | | - # Build the project for Web using both engine SDK and engine in subdirectory. |
39 | | - # SDK build is published to itch.io. |
40 | | - Web: |
41 | | - if: github.event.pull_request.draft == false |
42 | | - runs-on: ubuntu-latest |
43 | | - needs: [CheckSkipCI] |
44 | | - |
45 | | - strategy: |
46 | | - fail-fast: false |
47 | | - matrix: |
48 | | - ci_build_mode: |
49 | | - - sdk |
50 | | - - subdirectory |
51 | | - |
52 | | - env: |
53 | | - ci_platform: web |
54 | | - ci_native_sdk_name: rebelfork-sdk-linux-clang-x64-dll-latest |
55 | | - ci_target_sdk_name: rebelfork-sdk-web-emscripten-wasm-lib-latest |
56 | | - ci_emsdk_version: latest |
57 | | - ci_build_mode: ${{ matrix.ci_build_mode }} |
58 | | - ci_publish: ${{ github.ref == 'refs/heads/master' && github.repository == 'rbfx/sample-project' && matrix.ci_build_mode == 'sdk'}} |
59 | | - BINARYEN_CORES: 1 |
| 30 | + github.event.workflow_run.conclusion == 'success' && |
| 31 | + github.event.workflow_run.event == 'push' && |
| 32 | + github.event.workflow_run.repository.full_name == 'rbfx/sample-project' |
60 | 33 |
|
61 | 34 | steps: |
62 | | - - uses: mymindstorm/setup-emsdk@v11 |
63 | | - with: |
64 | | - version: ${{ env.ci_emsdk_version }} |
65 | | - |
66 | 35 | - name: Checkout Sample Project |
67 | | - uses: actions/checkout@v2 |
| 36 | + uses: actions/checkout@v5 |
68 | 37 | with: |
69 | | - path: ${{ env.ci_source_dir }} |
| 38 | + ref: ${{ github.event.workflow_run.head_sha }} |
| 39 | + path: source-code |
70 | 40 | fetch-depth: 1 |
71 | 41 | submodules: true |
72 | 42 |
|
73 | | - - name: Checkout the Framework |
74 | | - if: ${{ matrix.ci_build_mode == 'subdirectory' }} |
75 | | - uses: actions/checkout@v2 |
| 43 | + - name: Download web build artifact |
| 44 | + uses: actions/download-artifact@v4 |
76 | 45 | with: |
77 | | - repository: rbfx/rbfx |
78 | | - path: ${{ env.ci_source_dir }}/../rbfx |
79 | | - fetch-depth: 1 |
80 | | - submodules: true |
81 | | - |
82 | | - - name: Download native SDK |
83 | | - uses: robinraju/release-downloader@v1.8 |
| 46 | + github-token: ${{ github.token }} |
| 47 | + repository: ${{ github.event.workflow_run.repository.full_name }} |
| 48 | + run-id: ${{ github.event.workflow_run.id }} |
| 49 | + name: sample-project-build-web-emscripten-wasm-lib |
| 50 | + path: ${{ env.ci_web_build_dir }} |
| 51 | + |
| 52 | + - name: Download Windows build artifact |
| 53 | + uses: actions/download-artifact@v4 |
84 | 54 | with: |
85 | | - repository: rbfx/rbfx |
86 | | - tag: latest |
87 | | - fileName: ${{ env.ci_native_sdk_name }}.7z |
| 55 | + github-token: ${{ github.token }} |
| 56 | + repository: ${{ github.event.workflow_run.repository.full_name }} |
| 57 | + run-id: ${{ github.event.workflow_run.id }} |
| 58 | + name: sample-project-build-windows-msvc-x64-lib |
| 59 | + path: ${{ env.ci_windows_build_dir }} |
88 | 60 |
|
89 | | - - name: Unzip native SDK |
90 | | - run: | |
91 | | - cd '${{ github.workspace }}' |
92 | | - 7z x '${{ env.ci_native_sdk_name }}.7z' '-o${{ github.workspace }}' -y |
93 | | - mv './${{ env.ci_native_sdk_name }}' ./SDK-native |
94 | | -
|
95 | | - - name: Download target SDK |
96 | | - if: ${{ matrix.ci_build_mode == 'sdk' }} |
| 61 | + - name: Download Windows SDK |
97 | 62 | uses: robinraju/release-downloader@v1.8 |
98 | 63 | with: |
99 | 64 | repository: rbfx/rbfx |
100 | 65 | tag: latest |
101 | | - fileName: ${{ env.ci_target_sdk_name }}.7z |
| 66 | + fileName: rebelfork-sdk-windows-msvc-x64-lib-latest.7z |
102 | 67 |
|
103 | | - - name: Unzip target SDK |
104 | | - if: ${{ matrix.ci_build_mode == 'sdk' }} |
| 68 | + - name: Unzip Windows SDK |
105 | 69 | run: | |
106 | 70 | cd '${{ github.workspace }}' |
107 | | - 7z x '${{ env.ci_target_sdk_name }}.7z' '-o${{ github.workspace }}' -y |
108 | | - mv './${{ env.ci_target_sdk_name }}' ./SDK-target |
109 | | -
|
110 | | - - name: Setup cmake |
111 | | - uses: jwlawson/actions-setup-cmake@v1.8 |
112 | | - with: |
113 | | - cmake-version: '${{ env.CMAKE_VERSION }}' |
114 | | - |
115 | | - - name: Dependencies |
116 | | - shell: bash |
117 | | - run: ${{ env.ci_build_script }} dependencies |
118 | | - |
119 | | - - name: Generate |
120 | | - shell: bash |
121 | | - run: ${{ env.ci_build_script }} generate |
122 | | - |
123 | | - - name: Build |
124 | | - shell: bash |
125 | | - run: ${{ env.ci_build_script }} build |
126 | | - |
127 | | - - name: Prepare |
128 | | - if: ${{ env.ci_publish }} |
129 | | - shell: bash |
| 71 | + rm -rf '${{ env.ci_target_sdk_dir }}' |
| 72 | + 7z x 'rebelfork-sdk-windows-msvc-x64-lib-latest.7z' '-o${{ github.workspace }}' -y |
| 73 | + mv './rebelfork-sdk-windows-msvc-x64-lib-latest' '${{ env.ci_target_sdk_dir }}' |
| 74 | + rm 'rebelfork-sdk-windows-msvc-x64-lib-latest.7z' |
| 75 | +
|
| 76 | + - name: Prepare web package |
| 77 | + env: |
| 78 | + ci_platform: web |
| 79 | + ci_build_dir: ${{ env.ci_web_build_dir }} |
| 80 | + ci_build_mode: sdk |
130 | 81 | run: ${{ env.ci_build_script }} prepare |
131 | 82 |
|
132 | | - - name: Publish |
133 | | - if: ${{ env.ci_publish }} |
134 | | - uses: KikimoraGames/itch-publish@v0.0.3 |
135 | | - with: |
136 | | - butlerApiKey: ${{ secrets.BUTLER_API_KEY }} |
137 | | - gameData: ${{ github.workspace }}/cmake-build/bin/project |
138 | | - itchUsername: eugeneko |
139 | | - itchGameId: sample-project |
140 | | - buildChannel: web |
141 | | - |
142 | | - # Build the project for Windows using both engine SDK and engine in subdirectory. |
143 | | - Windows: |
144 | | - if: github.event.pull_request.draft == false |
145 | | - runs-on: windows-2022 |
146 | | - needs: [CheckSkipCI] |
147 | | - |
148 | | - strategy: |
149 | | - fail-fast: false |
150 | | - matrix: |
151 | | - ci_build_mode: |
152 | | - - sdk |
153 | | - - subdirectory |
154 | | - |
155 | | - env: |
156 | | - ci_platform: windows |
157 | | - ci_target_sdk_name: rebelfork-sdk-windows-msvc-x64-lib-latest |
158 | | - ci_build_mode: ${{ matrix.ci_build_mode }} |
159 | | - ci_publish: ${{ github.ref == 'refs/heads/master' && github.repository == 'rbfx/sample-project' && matrix.ci_build_mode == 'sdk'}} |
160 | | - BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} |
161 | | - |
162 | | - steps: |
163 | | - - name: Checkout Sample Project |
164 | | - uses: actions/checkout@v3 |
165 | | - with: |
166 | | - path: ${{ env.ci_source_dir }} |
167 | | - fetch-depth: 1 |
168 | | - submodules: true |
169 | | - |
170 | | - - name: Checkout the Framework |
171 | | - if: ${{ matrix.ci_build_mode == 'subdirectory' }} |
172 | | - uses: actions/checkout@v2 |
173 | | - with: |
174 | | - repository: rbfx/rbfx |
175 | | - path: ${{ env.ci_source_dir }}/../rbfx |
176 | | - fetch-depth: 1 |
177 | | - submodules: true |
178 | | - |
179 | | - - name: Download target SDK |
180 | | - if: ${{ matrix.ci_build_mode == 'sdk' }} |
181 | | - uses: robinraju/release-downloader@v1.8 |
182 | | - with: |
183 | | - repository: rbfx/rbfx |
184 | | - tag: latest |
185 | | - fileName: ${{ env.ci_target_sdk_name }}.7z |
186 | | - |
187 | | - - name: Unzip target SDK |
188 | | - if: ${{ matrix.ci_build_mode == 'sdk' }} |
189 | | - run: | |
190 | | - cd '${{ github.workspace }}' |
191 | | - 7z x '${{ env.ci_target_sdk_name }}.7z' '-o${{ github.workspace }}' -y |
192 | | - mv './${{ env.ci_target_sdk_name }}' ./SDK-target |
| 83 | + - name: Prepare Windows package |
| 84 | + env: |
| 85 | + ci_platform: windows |
| 86 | + ci_build_dir: ${{ env.ci_windows_build_dir }} |
| 87 | + ci_build_mode: sdk |
| 88 | + run: ${{ env.ci_build_script }} prepare |
193 | 89 |
|
194 | 90 | - name: Set up butler |
195 | | - if: ${{ env.ci_publish }} |
196 | 91 | uses: jdno/setup-butler@v1 |
197 | 92 |
|
198 | | - - name: Setup cmake |
199 | | - uses: jwlawson/actions-setup-cmake@v1 |
200 | | - with: |
201 | | - cmake-version: '${{ env.CMAKE_VERSION }}' |
202 | | - |
203 | | - - name: Dependencies |
204 | | - shell: bash |
205 | | - run: ${{ env.ci_build_script }} dependencies |
206 | | - |
207 | | - - name: Generate |
208 | | - shell: bash |
209 | | - run: ${{ env.ci_build_script }} generate |
210 | | - |
211 | | - - name: Build |
212 | | - shell: bash |
213 | | - run: ${{ env.ci_build_script }} build |
214 | | - |
215 | | - - name: Prepare |
216 | | - if: ${{ env.ci_publish }} |
217 | | - shell: bash |
218 | | - run: ${{ env.ci_build_script }} prepare |
| 93 | + - name: Publish web build |
| 94 | + env: |
| 95 | + BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} |
| 96 | + run: | |
| 97 | + butler push "${{ env.ci_web_build_dir }}/bin/project" "eugeneko/sample-project:web" |
219 | 98 |
|
220 | | - - name: Publish |
221 | | - if: ${{ env.ci_publish }} |
| 99 | + - name: Publish Windows build |
| 100 | + env: |
| 101 | + BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} |
222 | 102 | run: | |
223 | | - butler push "${{ env.ci_build_dir }}/bin/project" "eugeneko/sample-project:windows" |
| 103 | + butler push "${{ env.ci_windows_build_dir }}/bin/project" "eugeneko/sample-project:windows" |
0 commit comments