Skip to content

Commit

Permalink
add deploy prod workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
glencoden committed Dec 5, 2022
1 parent 331120f commit f229eba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- main

jobs:
deploy-staging:
runs-on: ubuntu-latest
steps:
- name: copy ssh key
run: |
mkdir -p ~/.ssh
echo -e "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- name: pull wolke repository and run docker
run: |
ssh root@${{ secrets.SERVER_ADDRESS_PROD }} <<"ENDSSH"
mkdir -p /root/apps/wolke
cd /root/apps/wolke
git pull || git clone -b main --single-branch git@github.com:glencoden/wolke.git ./
docker compose down --rmi local
docker image prune -f
docker compose up -d --build
ENDSSH
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- name: pull wolke repository and run docker
run: |
ssh root@${{ secrets.SERVER_ADDRESS }} <<"ENDSSH"
ssh root@${{ secrets.SERVER_ADDRESS_STAGING }} <<"ENDSSH"
mkdir -p /root/apps/wolke
cd /root/apps/wolke
git pull || git clone -b staging --single-branch git@github.com:glencoden/wolke.git ./
Expand Down

0 comments on commit f229eba

Please sign in to comment.