-
Notifications
You must be signed in to change notification settings - Fork 31
79 lines (74 loc) · 2.43 KB
/
main.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
name: Build webadmin FE and Runner
on:
push:
paths:
- 'webadmin/fitcrackFE/**'
- 'runner/**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Extract branch name
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
shell: bash
run: echo "::set-env name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
# Check changes
- name: Check for changes in dirs
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
shell: bash
run: |
echo "::set-env name=FE_CHANGES::$(git diff --name-only HEAD HEAD~1 | grep webadmin/fitcrackFE/ | wc -l)"
echo "::set-env name=RN_CHANGES::$(git diff --name-only HEAD HEAD~1 | grep runner/ | wc -l)"
# Node FE build
- name: Set up Node ${{ matrix.node-version }}
if: env.FE_CHANGES > 0
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Make ABSOLUTELY sure server address is LOCALHOST and NOTHING ELSE DEFINITELY YES REALLY
if: env.FE_CHANGES > 0
working-directory: webadmin/fitcrackFE/public/static
run: |
sed -i 's/serverAddress.*/serverAddress = "http:\/\/localhost:5000"/g' configuration.js
- name: Install deps and build it
if: env.FE_CHANGES > 0
working-directory: webadmin/fitcrackFE
env:
CI: true
run: |
npm ci
npm run build --if-present
# Runner build
- name: Install mingw g++
if: env.RN_CHANGES > 0
run: sudo apt-get install g++-mingw-w64-x86-64
- name: Build Runner
if: env.RN_CHANGES > 0
working-directory: runner
run: |
bash update_client_bins.sh
make clean
# Commit & push back
- name: Commit files
run: |
git config --local user.email "me@ovi.moe"
git config --local user.name "Webpacker"
git add webadmin/fitcrackFE/public/static/configuration.js
git add server/client_bin/windows_x86_64/runner1.exe -f
git add server/client_bin/x86_64-pc-linux-gnu/runner1.bin -f
git add runner/bin/*.debug -f
git add .
git commit -m "Build webadmin frontend and Runner 🚀"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}