feat: test #24
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: "Test and Deploy" | |
on: | |
push: | |
branches: | |
main | |
jobs: | |
deploy: | |
environment: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: 'npm' | |
- name: install NX | |
run: npm i -g nx | |
- name: install deps | |
run: npm i | |
- name: Build apps | |
run: npm run build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: Build and Push development Docker image | |
run: sh ./deploy/deploy.sh tropaul322/front tropaul322/apiv2 | |
- name: Run docker-compose | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEVELOPMENT_HOST }} | |
username: ${{ secrets.DEVELOPMENT_USERNAME }} | |
key: ${{ vars.DEVELOPMENT_SSH_KEY }} | |
port: 22 | |
script: | | |
sudo docker pull tropaul322/apiv2:latest | |
sudo docker pull tropaul322/front:latest | |
sudo docker compose -f app/docker-compose.yml --compatibility up -d --force-recreate --no-deps | |
sudo docker system prune -fa --volumes |