-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* switch from DO to GitHub/prd for editor, engine & asset distribution * setup GitHub CI for distribution
- Loading branch information
Showing
5 changed files
with
126 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Launcher | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'dist_cfg/**' | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
build_cmd: "build-linux" | ||
arch: "--x64" | ||
|
||
- os: windows-latest | ||
build_cmd: "build-win" | ||
arch: "--x64" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# This should fix git rev-list --count HEAD | ||
# https://stackoverflow.com/a/65056108 | ||
fetch-depth: 0 | ||
path: repo-folder | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: gajop/spring-launcher | ||
path: spring-launcher | ||
|
||
- name: Setup NodeJs | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '17.x' | ||
|
||
- name: Prepare folder structure | ||
run: | | ||
mkdir build | ||
cp spring-launcher/* -r build/ | ||
cp repo-folder/dist_cfg/* -r build/src/ | ||
mkdir -p build/{bin,files,build} | ||
[ -d build/src/bin/ ] && mv build/src/bin/* build/bin/ | ||
[ -d build/src/files/ ] && mv build/src/files/* build/files/ | ||
[ -d build/src/build/ ] && mv build/src/build/* build/build/ | ||
rm -rf build/src/{bin,files,build} | ||
exit 0 | ||
- name: Make package.json | ||
run: | | ||
cd repo-folder | ||
export PACKAGE_VERSION=1.$(git rev-list --count HEAD).0 | ||
echo "Making build for version: $PACKAGE_VERSION" | ||
cd .. | ||
node ./repo-folder/build/make_package_json.js build/package.json repo-folder/dist_cfg/config.json Spring-SpringBoard/SpringBoard-Core $PACKAGE_VERSION | ||
- name: Build | ||
run: | | ||
cd build | ||
npm install | ||
npm run ${{ matrix.build_cmd }} -- ${{ matrix.arch }} --publish always | ||
env: | ||
GH_TOKEN: ${{ secrets.github_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const assert = require('assert'); | ||
|
||
function createPackagejson (packageJson, configJson, repoFullName, version) { | ||
const configStr = fs.readFileSync(configJson); | ||
const config = JSON.parse(configStr); | ||
|
||
assert(config.title != null, 'Missing config title'); | ||
|
||
const repoDotName = repoFullName.replace(/\//g, '.'); | ||
|
||
const packageTemplate = JSON.parse(fs.readFileSync(packageJson).toString()); | ||
packageTemplate.name = config.title.replace(/ /g, '-'); | ||
// eslint-disable-next-line no-template-curly-in-string | ||
packageTemplate.build.artifactName = config.title + '-${version}.${ext}'; // '' is used on purpose, we want the spring to contain ${ext} as text | ||
packageTemplate.version = version; | ||
packageTemplate.repository = `github:${repoFullName}`; | ||
packageTemplate.build.appId = `com.springrts.launcher.${repoDotName}`; | ||
packageTemplate.build.publish = undefined; | ||
if (config.dependencies != null) { | ||
for (const dependency in config.dependencies) { | ||
packageTemplate.dependencies[dependency] = config.dependencies[dependency]; | ||
} | ||
} | ||
|
||
fs.writeFileSync(packageJson, JSON.stringify(packageTemplate), 'utf8'); | ||
} | ||
|
||
if (require.main === module) { | ||
const args = process.argv; | ||
if (args.length < 6) { | ||
console.log('Wrong arguments'); | ||
process.exit(-1); | ||
} | ||
|
||
createPackagejson(args[2], args[3], args[4], args[5]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters