73 lines
1.6 KiB
YAML
73 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*' # Triggers on all tags
|
|
branches:
|
|
- '**' # Triggers on all branches
|
|
|
|
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
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: build
|
|
runs-on: ubuntu
|
|
container:
|
|
image: node:20
|
|
steps:
|
|
- name: Install build tools
|
|
run: apt update && apt install -y zip
|
|
|
|
- name: Download compiled binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: ncsambawatcher
|
|
|
|
- name: Copy files
|
|
run: |
|
|
mkdir build
|
|
cp ncsambawatcher build/ncsambawatcher
|
|
cp configs/ncsambawatcher.config.default build/ncsambawatcher.config
|
|
cp configs/ncsambawatcher.service.default build/ncsambawatcher.service
|
|
cp init.sh build/init.sh
|
|
|
|
- name: Create release zip
|
|
run: |
|
|
cd build
|
|
zip ../ncsambawatcher.zip ./*
|
|
|
|
- name: Publish release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
release_name: Release ${{ github.ref_name }}
|
|
files: |
|
|
ncsambawatcher.zip
|