forked from BlockDash-Studios/RustAcademy
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.54 KB
/
Copy pathcd.yml
File metadata and controls
49 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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