Skip to content

Commit

Permalink
Merge pull request #9 from andrey-kondratov/feature/auto-deploy-on-test
Browse files Browse the repository at this point in the history
CI/CD
  • Loading branch information
andrey-kondratov authored Aug 14, 2024
2 parents 21df202 + 6618680 commit 48f0118
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
- name: Restore tools
run: dotnet tool restore
- name: Build
run: dotnet cake
- name: Push
run: echo "${{ github.token }}" | dotnet cake --target Push --tag ${{ steps.meta.outputs.version }}
run: echo "${{ github.token }}" | dotnet cake --target Push --tag ${{ github.repository.is_default_branch && 'latest' || format('pr-{0}', github.event.pull_request.number) }}
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy

on:
workflow_dispatch:

jobs:
deploy:
runs-on: host,ARM64
environment: prod
steps:
- name: Update DockerCompose
run: |
cat << EOF > docker-compose.yml
services:
bot:
image: ghcr.io/${{ github.repository }}:latest-arm64v8
container_name: pills-bot
environment:
PILLSBOT__CONNECTION__APITOKEN: ${{ secrets.PILLSBOT__CONNECTION__APITOKEN }}
PILLSBOT__CONNECTION__CHATID: "${{ secrets.PILLSBOT__CONNECTION__CHATID }}"
PILLSBOT__AI__ENABLED: ${{ vars.PILLSBOT__AI__ENABLED }}
PILLSBOT__AI__LANGUAGES: ${{ secrets.PILLSBOT__AI__LANGUAGES }}
PILLSBOT__AI__PETNAMES: ${{ secrets.PILLSBOT__AI__PETNAMES }}
PILLSBOT__AI__PETGENDER: ${{ secrets.PILLSBOT__AI__PETGENDER }}
PILLSBOT__AI__LOGLEVEL: ${{ vars.PILLSBOT__AI__LOGLEVEL }}
PILLSBOT__AI__AZURE__ENDPOINT: ${{ secrets.PILLSBOT__AI__AZURE__ENDPOINT }}
PILLSBOT__AI__AZURE__KEY: ${{ secrets.PILLSBOT__AI__AZURE__KEY }}
PILLSBOT__AI__AZURE__DEPLOYMENTNAME: ${{ secrets.PILLSBOT__AI__AZURE__DEPLOYMENTNAME }}
restart: unless-stopped
EOF
- name: Restart
run: docker compose up --detach --pull always --quiet-pull --remove-orphans --wait --wait-timeout 60
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/andreikondratov/pills-bot)](https://hub.docker.com/r/andreikondratov/pills-bot)

# Pills bot

If you have a cat that needs pills given to him on a regular schedule, and you sometimes forget - this Telegram bot will remind you.
Expand All @@ -17,7 +15,7 @@ Create a `docker-compose.yml`:
```yml
services:
bot:
image: andreikondratov/pills-bot:latest # or latest-arm64v8 if running on Raspberry Pi
image: ghcr.io/andrey-kondratov/pills-bot:latest # or latest-arm64v8 if running on Raspberry Pi
environment:
PILLSBOT__CONNECTION__APITOKEN: "YOUR TOKEN"
PILLSBOT__CONNECTION__CHATID: "YOUR CHAT OR USER ID" # send the bot a message to see it in the logs
Expand All @@ -36,7 +34,7 @@ If you prefer not to use Azure OpenAI and simply send a static message:
```yml
services:
bot:
image: andreikondratov/pills-bot:latest
image: ghcr.io/andrey-kondratov/pills-bot:latest
environment:
PILLSBOT__CONNECTION__APITOKEN: "YOUR TOKEN"
PILLSBOT__CONNECTION__CHATID: "YOUR CHAT OR USER ID"
Expand Down

0 comments on commit 48f0118

Please sign in to comment.