Skip to content

Commit

Permalink
add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jmilldotdev committed Nov 21, 2023
1 parent d6748da commit 136b586
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 5 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Build and Deploy - Bots'

on:
workflow_dispatch:
push:
branches: [main]

pull_request:
branches: [main]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
ENV_STAGE: stage

jobs:
build-and-push-to-ghcr:
name: Build
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
outputs:
tag: ${{ steps.prep.outputs.tag }}
steps:
- uses: actions/checkout@v2

- id: prep
run: |
TAG=$(echo $GITHUB_SHA | head -c7)
IMAGE="${{ env.REGISTRY }}/edenartlab/bots"
echo ::set-output name=tagged_image::${IMAGE}:${TAG}
echo ::set-output name=tag::${TAG}
echo ::set-output name=image::${IMAGE}
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags:
${{ steps.prep.outputs.tagged_image }},${{ steps.prep.outputs.image
}}:latest
9 changes: 9 additions & 0 deletions src/bots/banny/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DISCORD_TOKEN=
MONGO_URI=
MONGO_DB_NAME=
EDEN_API_URL=
EDEN_API_KEY=
EDEN_API_SECRET=
ALLOWED_GUILDS=
ALLOWED_GUILDS_TEST=
ALLOWED_CHANNELS=
10 changes: 10 additions & 0 deletions src/bots/eden/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DISCORD_TOKEN=
MONGO_URI=
MONGO_DB_NAME=
EDEN_API_URL=
EDEN_API_KEY=
EDEN_API_SECRET=
ALLOWED_GUILDS=
ALLOWED_GUILDS_TEST=
ALLOWED_CHANNELS=
OPENAI_API_KEY=
10 changes: 5 additions & 5 deletions src/cogs/AssistantCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def on_message(self, message: discord.Message) -> None:
reply_message = await message.reply(reply)

# check if there is a config
config = response["attachment"]
config = response["config"]
if not config:
return

Expand All @@ -97,12 +97,12 @@ async def on_message(self, message: discord.Message) -> None:
text_input = mode

if "init_image_data" in config:
config["init_image_data"] = attachment_lookup_url[
config["init_image_data"] = attachment_lookup_url.get(
config["init_image_data"]
]
)
if "interpolation_init_images" in config:
config["interpolation_init_images"] = [
attachment_lookup_url[img]
attachment_lookup_url.get(img)
for img in config["interpolation_init_images"]
]

Expand All @@ -129,7 +129,7 @@ async def on_message(self, message: discord.Message) -> None:
is_video_request=is_video_request,
)
await generation_loop(
generation_loop_input, eden_credentials=self.sign_in_credentials
generation_loop_input, eden_credentials=self.eden_credentials
)

def message_preprocessor(self, message: discord.Message) -> str:
Expand Down

0 comments on commit 136b586

Please sign in to comment.