Launcher #172
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
name: Launcher | |
on: | |
# 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-22.04 | |
build_cmd: "build-linux" | |
arch: "--x64" | |
- os: windows-latest | |
build_cmd: "build-win" | |
arch: "--x64" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# This should fix git rev-list --count HEAD | |
# https://stackoverflow.com/a/65056108 | |
fetch-depth: 0 | |
path: BYAR-Chobby | |
- uses: actions/checkout@v3 | |
with: | |
repository: beyond-all-reason/spring-launcher | |
path: launcher | |
- name: Setup NodeJs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: launcher/package-lock.json | |
- name: Patch launcher with dist_cfg | |
run: | | |
cp -r BYAR-Chobby/dist_cfg/* launcher/src/ | |
for dir in bin files build; do | |
mkdir -p launcher/$dir | |
if [ -d launcher/src/$dir/ ]; then | |
mv launcher/src/$dir/* launcher/$dir/ | |
rm -rf launcher/src/$dir | |
fi | |
done | |
exit 0 | |
- name: Make package.json | |
run: | | |
cd BYAR-Chobby | |
export PACKAGE_VERSION=1.$(git rev-list --count HEAD).0 | |
echo "Making build for version: $PACKAGE_VERSION" | |
node build/make_package_json.js ../launcher/package.json dist_cfg/config.json $GITHUB_REPOSITORY $PACKAGE_VERSION | |
- name: Cache electron | |
uses: actions/cache@v3 | |
with: | |
path: .electron-cache | |
key: ${{ runner.os }}-electron-cache-${{ hashFiles('launcher/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-electron-cache- | |
- name: Build | |
run: | | |
cd launcher | |
npm ci | |
npm run ${{ matrix.build_cmd }} -- ${{ matrix.arch }} --publish always | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_CACHE: ${{ github.workspace }}/.electron-cache/main | |
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.electron-cache/builder |