Merge 2 workflows into one
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push: {}
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
working-directory: .
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu
|
|
||||||
container:
|
|
||||||
image: node:20
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install tools
|
|
||||||
run: apt update && apt install -y build-essential
|
|
||||||
|
|
||||||
- name: Compile project
|
|
||||||
run: make
|
|
||||||
|
|
||||||
- name: Save build output
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: ncsambawatcher
|
|
||||||
path: ./ncsambawatcher
|
|
||||||
@@ -1,25 +1,48 @@
|
|||||||
name: Release
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- v.*
|
- '*' # Triggers on all tags
|
||||||
|
branches:
|
||||||
|
- '**' # Triggers on all branches
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: .
|
working-directory: .
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
build:
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
|
container:
|
||||||
|
image: node:20
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install tools
|
||||||
|
run: apt update && apt install -y build-essential
|
||||||
|
|
||||||
|
- name: Compile project
|
||||||
|
run: make
|
||||||
|
|
||||||
|
- name: Save build output
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ncsambawatcher
|
||||||
|
path: ./ncsambawatcher
|
||||||
|
|
||||||
|
release:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
needs: build
|
needs: build
|
||||||
|
runs-on: ubuntu
|
||||||
container:
|
container:
|
||||||
image: node:20
|
image: node:20
|
||||||
steps:
|
steps:
|
||||||
- name: Install build tools
|
- name: Install build tools
|
||||||
run: apt update && apt install -y zip
|
run: apt update && apt install -y zip
|
||||||
|
|
||||||
- name: Download compiled binary
|
- name: Download compiled binary
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -30,7 +53,8 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
cp ncsambawatcher build/ncsambawatcher
|
cp ncsambawatcher build/ncsambawatcher
|
||||||
cp configs/ncsambawatcher.config.default build/ncsambawatcher.config
|
cp configs/ncsambawatcher.config.default build/ncsambawatcher.config
|
||||||
cp init.sh config/init.sh
|
cp configs/ncsambawatcher.service.default build/ncsambawatcher.service
|
||||||
|
cp init.sh build/init.sh
|
||||||
|
|
||||||
- name: Create release zip
|
- name: Create release zip
|
||||||
run: |
|
run: |
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -91,4 +91,5 @@ watch.c
|
|||||||
ncwatchfile
|
ncwatchfile
|
||||||
ncsambawatcher
|
ncsambawatcher
|
||||||
|
|
||||||
obj/
|
obj/
|
||||||
|
build/
|
||||||
@@ -4,12 +4,11 @@ After=network.target docker.service
|
|||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/ncsambawatcher
|
ExecStart=/path/to/folder/ncsambawatcher
|
||||||
|
WorkingDirectory=/path/to/folder/
|
||||||
Restart=always
|
Restart=always
|
||||||
User=root
|
User=root
|
||||||
Group=root
|
Group=root
|
||||||
WorkingDirectory=/usr/bin/
|
|
||||||
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
SyslogIdentifier=ncsambawatcher
|
SyslogIdentifier=ncsambawatcher
|
||||||
8
init.sh
8
init.sh
@@ -1,11 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
make
|
current_dir=$(pwd)
|
||||||
|
sed -i "s|/path/to/folder/|$current_dir/|g" ncsambawatcher.service
|
||||||
|
|
||||||
sudo cp ncsambawatcher /usr/bin/
|
sudo cp ./ncsambawatcher.service /etc/systemd/system
|
||||||
sudo chmod +x /usr/bin/ncsambawatcher
|
|
||||||
|
|
||||||
sudo cp configs/ncsambawatcher.service /etc/systemd/system
|
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable ncsambawatcher.service
|
sudo systemctl enable ncsambawatcher.service
|
||||||
|
|||||||
Reference in New Issue
Block a user