Merge pull request #5 from include-davis/feat/ci-cd #5
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: Staging Deployment | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
deploy_staging: | |
name: Deploy Staging | |
runs-on: ubuntu-latest | |
environment: | |
name: staging | |
url: ${{ vars.ENV_URL }} | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21.1.0' | |
- name: Install dependencies | |
run: npm install | |
- name: Install railway | |
run: npm install -g @railway/[email protected] | |
- name: Lint check | |
run: npm run lint | |
- name: Sync Prisma to Env | |
run: npx prisma generate | |
- name: Schema check and generation | |
run: npm run schema:gen | |
- name: Run Migrations | |
run: npm run db:migrate | |
- name: Deploy image to Railway | |
run: > | |
RAILWAY_TOKEN=${{ secrets.RAILWAY_TOKEN }} | |
railway up | |
--service "apollo" | |
-d | |
- name: Success | |
run: echo "🛠️ Deploy successful 🛠️" |