Skip to content

Commit

Permalink
Consolidated workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-kondratov committed Aug 19, 2024
1 parent ea44286 commit fde6d1e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 57 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and deploy

on:
pull_request:
Expand All @@ -7,6 +7,7 @@ on:
push:
branches:
- master
workflow_dispatch:

env:
out_dir: ${{ vars.OUTPUT_DIR }}
Expand All @@ -23,7 +24,7 @@ jobs:
run: dotnet tool restore
- name: Push
run: echo "${{ github.token }}" | dotnet cake --target Push --tag ${tag}
deploy:
deploy-test:
needs:
- build
runs-on: [host, ARM64]
Expand Down Expand Up @@ -67,4 +68,48 @@ jobs:
run: |
cd $out_dir
docker compose up --detach --pull always --quiet-pull --remove-orphans --wait --wait-timeout 60
deploy-prod:
runs-on: [host, ARM64]
environment: prod
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Update DockerCompose
run: |
mkdir -p $out_dir
cp src/docker-compose.yml $out_dir
cd $out_dir
cat << EOF > docker-compose.override.yml
services:
server:
image: ghcr.io/${{ github.repository }}:${tag}
db-init:
image: ghcr.io/${{ github.repository }}:${tag}
EOF
cat << EOF > server.env
DOTNET_ENVIRONMENT: Development
PILLSBOT__TELEGRAM__APITOKEN: ${{ secrets.PILLSBOT__TELEGRAM__APITOKEN }}
PILLSBOT__TELEGRAM__CHATID: "${{ secrets.PILLSBOT__TELEGRAM__CHATID }}"
PILLSBOT__REMINDER__BEGINS: ${{ secrets.PILLSBOT__REMINDER__BEGINS }}
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__MAXTOKENS: ${{ vars.PILLSBOT__AI__MAXTOKENS }}
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 }}
APPLICATIONINSIGHTS__CONNECTIONSTRING: ${{ secrets.APPLICATIONINSIGHTS__CONNECTIONSTRING }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
CONNECTIONSTRINGS__PILLSBOTDBCONTEXT: Host=db;Database=${{ secrets.POSTGRES_DB }};Username=${{ secrets.POSTGRES_USER }};Password=${{ secrets.POSTGRES_PASSWORD }}
EOF
- name: Restart
run: |
cd $out_dir
docker compose up --detach --pull always --quiet-pull --remove-orphans --wait --wait-timeout 60
55 changes: 0 additions & 55 deletions .github/workflows/deploy-prod.yml

This file was deleted.

0 comments on commit fde6d1e

Please sign in to comment.