add migration to action (#73) #32
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: CICD with EC2 | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
BACKEND_ENV: stage | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
DB_USERNAME: ${{ secrets.DB_USERNAME }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_NAME: ${{ secrets.DB_NAME }} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/main' | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- run: yarn install --immutable | |
- run: npm run typeorm migration:run -- -d ./src/migration.config.ts | |
- run: yarn build | |
- name: rsync deployments | |
uses: burnett01/[email protected] | |
with: | |
switches: -avzr --delete --exclude=".env" | |
path: ./* | |
remote_path: /var/www/restaurant-service | |
remote_host: 52.76.71.215 | |
remote_user: ubuntu | |
remote_key: '${{ secrets.SSH_PRIVATE_KEY }}' |