diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00854b0..4ce5801 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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) }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..811fa89 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/README.md b/README.md index 19955c1..6c9f668 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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"