Skip to content

Commit

Permalink
Fix Azamat code
Browse files Browse the repository at this point in the history
  • Loading branch information
depocoder committed Oct 16, 2024
1 parent 2e58c33 commit 7393d0e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,39 @@ on:
workflows: [build]
types:
- completed
branches:
- main
workflow_dispatch:

env:
IMAGE_TAG: ${{ github.sha }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}

SSH_PORT: ${{ secrets.SSH_PORT }}


jobs:
build:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- name: Set up SSH private key.
run: eval "$(ssh-agent -s)"
- run: mkdir -p ~/.ssh
- run: ssh-keyscan ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- run: ssh-keyscan -p $SSH_PORT $SSH_HOST >> ~/.ssh/known_hosts
- run: ssh-agent -a $SSH_AUTH_SOCK > /dev/null
- run: ssh-add - <<< "${{ secrets.SSH_KEY }}"

- name: Add image tag to .version file
run: |
echo $IMAGE_TAG > .version
scp -P 666 .version $SSH_USER@$SSH_HOST:~/YetAnotherCalendar/.version
- name: Update docker compose
run: |
ssh $SSH_USER@$SSH_HOST "cd YetAnotherCalendar/ && YET_ANOTHER_CALENDAR_VERSION=$IMAGE_TAG docker compose up -d --build"
ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "cd YetAnotherCalendar/ && git pull origin main
YET_ANOTHER_CALENDAR_VERSION=$(cat .version) docker compose -f docker-compose.prod.yaml pull
YET_ANOTHER_CALENDAR_VERSION=$(cat .version) docker compose -f docker-compose.prod.yaml up -d"

0 comments on commit 7393d0e

Please sign in to comment.