Skip to content

Commit

Permalink
deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenaH84 committed Feb 6, 2024
1 parent 0830cc0 commit 7350a7b
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@ env:
WORKDIR: battmogui

jobs:

deploy:

name: deploy image
name: Deploy image
runs-on: ubuntu-latest

steps:
- name: install ssh keys
# check this thread to understand why its needed:
# <https://stackoverflow.com/a/70447517>
- name: Install SSH keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.ACTIONS_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ env.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect
run: ssh ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "cd ${{ env.WORKDIR }}"
- name: login registry
ssh-keyscan -H ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Test SSH Connection
run: ssh -o StrictHostKeyChecking=no ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "echo SSH connection successful"
- name: Login to Registry
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u lorenah84 --password-stdin
- name: pull and run containers
run: docker compose pull && docker compose docker-compose.yml up -d && exit"
- name: cleanup
- name: Pull and Run Containers
run: |
ssh ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "cd ${{ env.WORKDIR }} && \
docker compose pull && \
docker compose -f docker-compose.yml up -d"
- name: Cleanup
run: rm -rf ~/.ssh

0 comments on commit 7350a7b

Please sign in to comment.