mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-12 11:56:06 -05:00
74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
name: Builds
|
|
run-name: Validate Node and Docker Builds
|
|
on:
|
|
push:
|
|
branches:
|
|
- master # runs after Pull Request is merged
|
|
|
|
jobs:
|
|
Discord-Node-Build: # test if the node install and run
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node Environment lts/hydrogen
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/hydrogen
|
|
cache: "npm"
|
|
|
|
- name: Install Project Dependencies
|
|
run: |
|
|
npm install
|
|
|
|
- name: Build Application
|
|
run: |
|
|
npm run build
|
|
|
|
- name: Create Environment Variables
|
|
run: |
|
|
touch .env
|
|
echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env
|
|
echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env
|
|
echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env
|
|
|
|
# set -e ensures if nohup fails, this section fails
|
|
- name: Startup Discord Bot Client
|
|
run: |
|
|
set -e
|
|
nohup npm run prod &
|
|
|
|
Discord-Ollama-Container-Build: # test docker build and run
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node Environment lts/hydrogen
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/hydrogen
|
|
cache: "npm"
|
|
|
|
- name: Create Environment Variables
|
|
run: |
|
|
touch .env
|
|
echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env
|
|
echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env
|
|
echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env
|
|
|
|
- name: Setup Docker Network and Images
|
|
run: |
|
|
npm run docker:start-cpu
|
|
|
|
- name: Check Images Exist
|
|
run: |
|
|
(docker images | grep -q 'kevinthedang/discord-ollama' && docker images | grep -qE 'ollama/ollama') || exit 1
|
|
|
|
- name: Check Containers Exist
|
|
run: |
|
|
(docker ps | grep -q 'ollama' && docker ps | grep -q 'discord') || exit 1
|