Delete .env.local #10
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: Basic deploy | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
EC2-Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Write .env file | |
run: | | |
echo "${{ secrets.ENV_FILE }}" > .env | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build docker_compose | |
run: docker-compose up -d --build | |
- name: Build application | |
run: docker-compose exec -T service npm run build | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Deploy application | |
run: | | |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key | |
ssh -o StrictHostKeyChecking=no -i private_key ${USERNAME}@${HOSTNAME} ' | |
cd /<path to your cloned github repository on the server> && | |
git checkout main && | |
git fetch --all && | |
git reset --hard origin/main && | |
git pull origin main && | |
docker-compose up -d --build | |
' |