-
Notifications
You must be signed in to change notification settings - Fork 7
175 lines (160 loc) Β· 6.81 KB
/
build-on-push.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
166
167
168
169
170
171
172
173
174
175
# Workflow to automatically compile a Linux/Windows library on commit/push
name: Build on push
# Controls when the action will run. Triggers the workflow on push or pull request
# events, but only for the main branch we'll create .zip files
on:
[push, pull_request]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job builds the plugin for our target platforms
build:
name: Building for ${{ matrix.platform }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
# Unsupported platforms are commented out.
#- name: π§ Linux (GCC)
# os: ubuntu-20.04
# platform: linux
# artifact-name: gdtiltfive.linux
# artifact-path: build/bin/libgdtiltfive.linux.*
- name: π Windows (x86_64, MSVC)
os: windows-2019
platform: windows
artifact-name: gdtiltfive.windows
artifact-path: |
build/bin/libgdtiltfive.windows.template_debug.x86_64.dll
build/bin/libgdtiltfive.windows.template_release.x86_64.dll
extension/TiltFiveNDK/lib/win/x86_64/TiltFiveNative.dll
#- name: π macOS (universal)
# os: macos-11
# platform: macos
# flags: arch=universal
# artifact-name: gdtiltfive.macos
# artifact-path: build/bin/libgdtiltfive.macos.*
#- name: π€ Android (arm64)
# os: ubuntu-20.04
# platform: android
# flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
# artifact-name: gdtiltfive.android
# artifact-path: build/bin/libgdtiltfive.android.*
#- name: π iOS (arm64)
# os: macos-11
# platform: ios
# flags: arch=arm64
# artifact-name: gdtiltfive.ios
# artifact-path: build/bin/libgdtiltfive.ios.*
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Setup actions
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up Python (for SCons)
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Linux dependencies
if: ${{ matrix.platform == 'linux' }}
run: |
sudo apt-get update -qq
sudo apt-get install -qqq build-essential pkg-config
- name: Install scons
run: |
python -m pip install scons==4.0.0
- name: Build debug build
run: |
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }}
- name: Build release build
run: |
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}
if-no-files-found: error
# This job collects the build output and assembles the final asset (artifact)
asset:
name: Assembling the asset (artifact)
runs-on: ubuntu-20.04
needs: build
permissions:
contents: write
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags'))
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Setup actions
uses: actions/checkout@v3
with:
path: source
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Copy files to destination for gdscript
run: |
mkdir plugin
mkdir plugin/addons
cp -r source/example.gd/addons/tiltfive plugin/addons
cp source/LICENSE.txt plugin/addons/tiltfive
cp source/CONTRIBUTORS.md plugin/addons/tiltfive
cp source/CHANGES.md plugin/addons/tiltfive
mkdir plugin/addons/tiltfive/bin
# cp gdtiltfive.linux/*.so plugin/addons/tiltfive/bin/
cp gdtiltfive.windows/build/bin/*.dll plugin/addons/tiltfive/bin/
cp gdtiltfive.windows/extension/TiltFiveNDK/lib/win/x86_64/*.dll plugin/addons/tiltfive/bin/
# cp gdtiltfive.android/*.so plugin/addons/tiltfive/bin/
# cp gdtiltfive.ios/*.dylib plugin/addons/tiltfive/bin/
# cp -R gdtiltfive.macos/libgdtiltfive.macos.* plugin/addons/tiltfive/bin/
- name: Copy files to destination for csharp
run: |
mkdir plugin_cs
mkdir plugin_cs/addons
cp -r source/example.csharp/addons/tiltfive plugin_cs/addons
cp source/LICENSE.txt plugin_cs/addons/tiltfive
cp source/CONTRIBUTORS.md plugin_cs/addons/tiltfive
cp source/CHANGES.md plugin_cs/addons/tiltfive
mkdir plugin_cs/addons/tiltfive/bin
# cp gdtiltfive.linux/*.so plugin_cs/addons/tiltfive/bin/
cp gdtiltfive.windows/build/bin/*.dll plugin_cs/addons/tiltfive/bin/
cp gdtiltfive.windows/extension/TiltFiveNDK/lib/win/x86_64/*.dll plugin_cs/addons/tiltfive/bin/
# cp gdtiltfive.android/*.so plugin_cs/addons/tiltfive/bin/
# cp gdtiltfive.ios/*.dylib plugin_cs/addons/tiltfive/bin/
# cp -R gdtiltfive.macos/libgdtiltfive.macos.* plugin_cs/addons/tiltfive/bin/
- name: Calculate GIT short ref
run: |
cd source
echo "GITHUB_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
cd ..
if: github.ref == 'refs/heads/main'
- name: Get tag name
run: |
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags')
- name: Clean up extracted files
run: |
# rm -rf gdtiltfive.linux
rm -rf gdtiltfive.windows
# rm -rf gdtiltfive.android
# rm -rf gdtiltfive.macos
# rm -rf gdtiltfive.ios
rm -rf source
rm -rf .git
mv plugin gdtiltfive_${{ env.GITHUB_SHA_SHORT }}
mv plugin_cs gdtiltfive_cs_${{ env.GITHUB_SHA_SHORT }}
- name: Zip asset
run: |
zip -qq -r gdtiltfive_gdscript.zip gdtiltfive_${{ env.GITHUB_SHA_SHORT }}
zip -qq -r gdtiltfive_csharp.zip gdtiltfive_cs_${{ env.GITHUB_SHA_SHORT }}
- name: Create and upload asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "gdtiltfive_gdscript.zip, gdtiltfive_csharp.zip"
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate : true
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')