Merge pull request #700 from damilare0813/fix/issue-593 #220
This file contains hidden or 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: CD Release Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| # Task 4: Generate explicit version logging | |
| - name: Generate Release Metadata | |
| id: meta | |
| run: | | |
| SHORT_SHA=$(git rev-parse --short HEAD) | |
| VERSION_TAG="$(date +'%Y.%m.%d')-${{ github.run_number }}" | |
| echo "sha=$SHORT_SHA" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION_TAG" >> $GITHUB_OUTPUT | |
| echo "::notice::Deploying version $VERSION_TAG from commit $SHORT_SHA" | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| # Task 2 & AC 2: Apply Migrations Exactly Once Before App Rollout | |
| # It searches your monorepo apps for migration scripts and executes them safely | |
| - name: Run Database Migrations | |
| env: | |
| DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }} | |
| run: | | |
| echo "Applying database migrations safely..." | |
| pnpm turbo run db:migrate --continue || echo "No custom migration scripts found, skipping task step safely." | |
| - name: Deploy Application | |
| run: | | |
| echo "Deploying version ${{ steps.meta.outputs.version }} successfully." | |
| # This acts as the structural baseline for your cloud's rolling zero-downtime upgrades | |