forked from nesfit/fitcrack
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (74 loc) · 2.39 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 Agent
on:
push:
paths:
- 'frontend/**'
- 'agent/**'
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 frontend/ | wc -l)"
echo "::set-env name=RN_CHANGES::$(git diff --name-only HEAD HEAD~1 | grep agent/ | 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: frontend/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: frontend
env:
CI: true
run: |
npm ci
npm run build --if-present
# Agent build
- name: Install mingw g++
if: env.RN_CHANGES > 0
run: sudo apt-get install g++-mingw-w64-x86-64
- name: Build Agent
if: env.RN_CHANGES > 0
working-directory: agent
run: |
bash update_client_bins.sh
make clean
# Commit & push back
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "Assets Builder"
git add frontend/public/static/configuration.js
git add server/client_bin/windows_x86_64/agent1.exe -f
git add server/client_bin/x86_64-pc-linux-gnu/agent1.bin -f
git add agent/bin/*.debug -f
git add .
git commit -m "Build webadmin frontend and agent"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}