fix: README.md #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Frontend | |
id: frontend | |
env: | |
REGISTRY_NAME: pinkynrg | |
REPOSITORY_NAME: hoomes_frontend | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -f Dockerfile.frontend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest . | |
echo "Pushing image to Registry..." | |
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }} | |
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG | |
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest | |
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG" | |
- name: Backend | |
id: backend | |
env: | |
REGISTRY_NAME: pinkynrg | |
REPOSITORY_NAME: hoomes_backend | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -f Dockerfile.backend -t $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG -t $REGISTRY_NAME/$REPOSITORY_NAME:latest . | |
echo "Pushing image to Registry..." | |
docker login -u pinkynrg -p ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }} | |
docker push $REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG | |
docker push $REGISTRY_NAME/$REPOSITORY_NAME:latest | |
echo "::set-output name=image::$REGISTRY_NAME/$REPOSITORY_NAME:$IMAGE_TAG" | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: checking out project | |
uses: actions/checkout@v2 | |
- name: copy file via ssh password | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOOMES_SSH_HOST }} | |
username: ${{ secrets.HOOMES_SSH_USER }} | |
password: ${{ secrets.HOOMES_SSH_PASSWORD }} | |
port: ${{ secrets.HOOMES_SSH_PORT }} | |
source: "docker-compose.yml,shell.db" | |
target: "~/hoomes" | |
- name: executing docker compose stuff on remove host | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOOMES_SSH_HOST }} | |
username: ${{ secrets.HOOMES_SSH_USER }} | |
password: ${{ secrets.HOOMES_SSH_PASSWORD }} | |
port: ${{ secrets.HOOMES_SSH_PORT }} | |
script: | | |
cd hoomes | |
[ -e "data.db" ] && rm "shell.db" || mv "shell.db" "data.db" | |
docker compose down | |
docker compose pull | |
NORD_VPN_PRIVATE_KEY=${{ secrets.NORD_VPN_PRIVATE_KEY }} docker compose up -d |