Skip to content

Commit e413c74

Browse files
committed
Use a reusable workflow.
1 parent 266ffc0 commit e413c74

4 files changed

Lines changed: 128 additions & 193 deletions

File tree

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'no-ci-**'
7+
- 'skip-ci-**'
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
CheckSkipCI:
13+
runs-on: ubuntu-latest
14+
if: |
15+
!contains(github.event.head_commit.message, '[skip ci]') &&
16+
!contains(github.event.pull_request.title, '[skip ci]') &&
17+
!contains(github.event.head_commit.message, '[skip-ci]') &&
18+
!contains(github.event.pull_request.title, '[skip-ci]')
19+
steps:
20+
- run: exit 0
21+
22+
Build:
23+
if: github.event.pull_request.draft == false
24+
needs: [CheckSkipCI]
25+
uses: rokups/rbfx-temp/.github/workflows/downstream-ci.yml@rk/ci-reusable-workflow
26+
secrets: inherit
27+
with:
28+
rbfx_source_repository: rokups/rbfx-temp
29+
rbfx_source_ref: rk/ci-reusable-workflow
30+
android_gradle_dir: android
31+
deploy_artifacts: true
32+
artifact_name_prefix: sample-project-build

.github/workflows/deploy.yml

Lines changed: 63 additions & 183 deletions
Original file line numberDiff line numberDiff line change
@@ -1,223 +1,103 @@
11
name: Deploy
22
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
1214

1315
env:
14-
# Common settings.
15-
CMAKE_VERSION: 3.25.x
16-
# Common paths.
1716
ci_source_dir: ${{ github.workspace }}/source-code
1817
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
2120
ci_target_sdk_dir: ${{ github.workspace }}/SDK-target
2221

2322
defaults:
2423
run:
2524
shell: bash
2625

2726
jobs:
28-
CheckSkipCI:
27+
Deploy:
2928
runs-on: ubuntu-latest
3029
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'
6033
6134
steps:
62-
- uses: mymindstorm/setup-emsdk@v11
63-
with:
64-
version: ${{ env.ci_emsdk_version }}
65-
6635
- name: Checkout Sample Project
67-
uses: actions/checkout@v2
36+
uses: actions/checkout@v5
6837
with:
69-
path: ${{ env.ci_source_dir }}
38+
ref: ${{ github.event.workflow_run.head_sha }}
39+
path: source-code
7040
fetch-depth: 1
7141
submodules: true
7242

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
7645
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
8454
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 }}
8860

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
9762
uses: robinraju/release-downloader@v1.8
9863
with:
9964
repository: rbfx/rbfx
10065
tag: latest
101-
fileName: ${{ env.ci_target_sdk_name }}.7z
66+
fileName: rebelfork-sdk-windows-msvc-x64-lib-latest.7z
10267

103-
- name: Unzip target SDK
104-
if: ${{ matrix.ci_build_mode == 'sdk' }}
68+
- name: Unzip Windows SDK
10569
run: |
10670
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
13081
run: ${{ env.ci_build_script }} prepare
13182

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
19389

19490
- name: Set up butler
195-
if: ${{ env.ci_publish }}
19691
uses: jdno/setup-butler@v1
19792

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"
21998
220-
- name: Publish
221-
if: ${{ env.ci_publish }}
99+
- name: Publish Windows build
100+
env:
101+
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
222102
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"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Provide `rbfx`:
1616
- Windows: provide `-DCMAKE_PREFIX_PATH=/path/to/rbfx-SDK/share`
1717
- Unix: provide `-DCMAKE_PREFIX_PATH=/path/to/rbfx-SDK`
1818

19-
Check out `Scripts/` folder and `.github/workflows/deploy.yml` to see how this sample can be built.
19+
Check out `.github/workflows/build.yml` and `.github/workflows/deploy.yml` to see how this sample is built and how deployment reuses build artifacts without recompiling.
2020

2121
## Running the Sample
2222

0 commit comments

Comments
 (0)