Skip to content

Commit ad8f878

Browse files
authored
Setup GitHub CI (#425)
* switch from DO to GitHub/prd for editor, engine & asset distribution * setup GitHub CI for distribution
1 parent b2553ae commit ad8f878

File tree

5 files changed

+126
-12
lines changed

5 files changed

+126
-12
lines changed

.github/workflows/launcher.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Launcher
2+
3+
on:
4+
push:
5+
paths:
6+
- 'dist_cfg/**'
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- os: ubuntu-20.04
22+
build_cmd: "build-linux"
23+
arch: "--x64"
24+
25+
- os: windows-latest
26+
build_cmd: "build-win"
27+
arch: "--x64"
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
with:
32+
# This should fix git rev-list --count HEAD
33+
# https://stackoverflow.com/a/65056108
34+
fetch-depth: 0
35+
path: repo-folder
36+
37+
- uses: actions/checkout@v2
38+
with:
39+
repository: gajop/spring-launcher
40+
path: spring-launcher
41+
42+
- name: Setup NodeJs
43+
uses: actions/setup-node@v1
44+
with:
45+
node-version: '17.x'
46+
47+
- name: Prepare folder structure
48+
run: |
49+
mkdir build
50+
cp spring-launcher/* -r build/
51+
cp repo-folder/dist_cfg/* -r build/src/
52+
mkdir -p build/{bin,files,build}
53+
[ -d build/src/bin/ ] && mv build/src/bin/* build/bin/
54+
[ -d build/src/files/ ] && mv build/src/files/* build/files/
55+
[ -d build/src/build/ ] && mv build/src/build/* build/build/
56+
rm -rf build/src/{bin,files,build}
57+
exit 0
58+
59+
- name: Make package.json
60+
run: |
61+
cd repo-folder
62+
export PACKAGE_VERSION=1.$(git rev-list --count HEAD).0
63+
echo "Making build for version: $PACKAGE_VERSION"
64+
cd ..
65+
node ./repo-folder/build/make_package_json.js build/package.json repo-folder/dist_cfg/config.json Spring-SpringBoard/SpringBoard-Core $PACKAGE_VERSION
66+
67+
- name: Build
68+
run: |
69+
cd build
70+
npm install
71+
npm run ${{ matrix.build_cmd }} -- ${{ matrix.arch }} --publish always
72+
env:
73+
GH_TOKEN: ${{ secrets.github_token }}

.luacheckrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ codes = true
1919
-- Default is probably fine, but anyway
2020
std=lua51
2121

22+
files["libs_sb/utils/luaunit.lua"] = { ignore = {"581"} }
23+
2224
globals = {
2325
-- std extensions
2426
"math.round", "math.bit_or",

build/make_package_json.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const assert = require('assert');
5+
6+
function createPackagejson (packageJson, configJson, repoFullName, version) {
7+
const configStr = fs.readFileSync(configJson);
8+
const config = JSON.parse(configStr);
9+
10+
assert(config.title != null, 'Missing config title');
11+
12+
const repoDotName = repoFullName.replace(/\//g, '.');
13+
14+
const packageTemplate = JSON.parse(fs.readFileSync(packageJson).toString());
15+
packageTemplate.name = config.title.replace(/ /g, '-');
16+
// eslint-disable-next-line no-template-curly-in-string
17+
packageTemplate.build.artifactName = config.title + '-${version}.${ext}'; // '' is used on purpose, we want the spring to contain ${ext} as text
18+
packageTemplate.version = version;
19+
packageTemplate.repository = `github:${repoFullName}`;
20+
packageTemplate.build.appId = `com.springrts.launcher.${repoDotName}`;
21+
packageTemplate.build.publish = undefined;
22+
if (config.dependencies != null) {
23+
for (const dependency in config.dependencies) {
24+
packageTemplate.dependencies[dependency] = config.dependencies[dependency];
25+
}
26+
}
27+
28+
fs.writeFileSync(packageJson, JSON.stringify(packageTemplate), 'utf8');
29+
}
30+
31+
if (require.main === module) {
32+
const args = process.argv;
33+
if (args.length < 6) {
34+
console.log('Wrong arguments');
35+
process.exit(-1);
36+
}
37+
38+
createPackagejson(args[2], args[3], args[4], args[5])
39+
}

dist_cfg/config.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
"platform": "win32"
1212
},
1313
"downloads": {
14-
"nextgen" : ["Spring-SpringBoard/SpringBoard-Core"],
14+
"games": ["sbc:test"],
1515
"resources": [
1616
{
17-
"url": "https://content.spring-launcher.com/engines/spring_%7Bmaintenance%7D104.0.1-1553-gd3c0012_win32-minimal-portable.7z",
17+
"url": "https://github.com/Spring-SpringBoard/SpringBoard-Resources/releases/download/resources/spring_.maintenance.104.0.1-1553-gd3c0012_win32-minimal-portable.7z",
1818
"destination": "engine/104.0.1-1553-gd3c0012 maintenance",
1919
"extract": true
2020
}
2121
]
2222
},
2323
"launch": {
24-
"game": "rapid://sbc:test",
24+
"games": ["sbc:test"],
2525
"map": "sb_initial_blank_10x8",
2626
"engine": "104.0.1-1553-gd3c0012 maintenance",
2727
"map_options": {
@@ -41,17 +41,17 @@
4141
"platform": "linux"
4242
},
4343
"downloads": {
44-
"nextgen" : ["Spring-SpringBoard/SpringBoard-Core"],
44+
"games": ["sbc:test"],
4545
"resources": [
4646
{
47-
"url": "https://content.spring-launcher.com/engines/spring_%7Bmaintenance%7D104.0.1-1553-gd3c0012_minimal-portable-linux64-static.7z",
47+
"url": "https://github.com/Spring-SpringBoard/SpringBoard-Resources/releases/download/resources/spring_.maintenance.104.0.1-1553-gd3c0012_minimal-portable-linux64-static.7z",
4848
"destination": "engine/104.0.1-1553-gd3c0012 maintenance",
4949
"extract": true
5050
}
5151
]
5252
},
5353
"launch": {
54-
"game": "rapid://sbc:test",
54+
"games": ["sbc:test"],
5555
"map": "sb_initial_blank_10x8",
5656
"engine": "104.0.1-1553-gd3c0012 maintenance",
5757
"map_options": {
@@ -71,7 +71,7 @@
7171
"platform": "win32"
7272
},
7373
"downloads": {
74-
"nextgen" : ["Spring-SpringBoard/SpringBoard-Core"],
74+
"games": ["sbc:test"],
7575
"resources": [
7676
{
7777
"url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR%7D104.0.1-1977-g12700e0/spring_bar_.BAR.104.0.1-1977-g12700e0_windows-64-minimal-portable.7z",
@@ -81,7 +81,7 @@
8181
]
8282
},
8383
"launch": {
84-
"game": "rapid://sbc:test",
84+
"games": ["sbc:test"],
8585
"map": "sb_initial_blank_10x8",
8686
"engine": "104.0.1-1977-g12700e0 bar",
8787
"map_options": {
@@ -101,7 +101,7 @@
101101
"platform": "linux"
102102
},
103103
"downloads": {
104-
"nextgen" : ["Spring-SpringBoard/SpringBoard-Core"],
104+
"games": ["sbc:test"],
105105
"resources": [
106106
{
107107
"url": "https://github.com/beyond-all-reason/spring/releases/download/spring_bar_%7BBAR%7D104.0.1-1977-g12700e0/spring_bar_.BAR.104.0.1-1977-g12700e0_linux-64-minimal-portable.7z",
@@ -111,7 +111,7 @@
111111
]
112112
},
113113
"launch": {
114-
"game": "rapid://sbc:test",
114+
"games": ["sbc:test"],
115115
"map": "sb_initial_blank_10x8",
116116
"engine": "104.0.1-1977-g12700e0 bar",
117117
"map_options": {
@@ -172,7 +172,7 @@
172172
"downloads": {
173173
"resources": [
174174
{
175-
"url": "https://content.spring-launcher.com/core_v1.zip",
175+
"url": "https://github.com/Spring-SpringBoard/SpringBoard-Resources/releases/download/resources/core_v1.zip",
176176
"destination": "springboard/assets/core-v1",
177177
"extract": true
178178
}

scen_edit/model/model.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Model:Clear()
3838
Spring.SetProjectileCollision(projectileID)
3939
end
4040

41-
if not Script.GetName() == "LuaUI" then
41+
if Script.GetName() ~= "LuaUI" then
4242
SB.commandManager:execute(ClearUndoRedoCommand())
4343
end
4444
end

0 commit comments

Comments
 (0)