|
1 | | -name: Deploy to Vapor Production |
| 1 | +name: Deploy to Vapor and Frontend |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | | - - master |
7 | | - - feat/vapor |
| 6 | + - main |
| 7 | + - feat/front-end-deployment |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - vapor: |
11 | | - name: Deploy to Vapor Production |
| 10 | + backend: |
| 11 | + name: Deploy Backend to Vapor |
12 | 12 | runs-on: ubuntu-latest |
13 | 13 |
|
14 | 14 | steps: |
15 | | - # Step 1: Checkout the repository |
16 | 15 | - uses: actions/checkout@v2 |
17 | 16 |
|
18 | | - # Step 2: Setup PHP |
19 | 17 | - name: Setup PHP |
20 | 18 | uses: shivammathur/setup-php@v2 |
21 | 19 | with: |
22 | 20 | php-version: 8.3 |
23 | 21 | tools: composer:v2 |
24 | 22 | coverage: none |
25 | 23 |
|
26 | | - # Step 3: Prepare Laravel Environment |
27 | 24 | - name: Prepare Laravel Environment |
28 | 25 | working-directory: ./backend |
29 | 26 | run: | |
30 | 27 | mkdir -p bootstrap/cache |
31 | 28 | chmod -R 775 bootstrap/cache |
32 | 29 |
|
33 | | - # Step 4: Prepare HTMLPurifier Cache Directory |
34 | 30 | - name: Prepare HTMLPurifier Cache Directory |
35 | 31 | working-directory: ./backend |
36 | 32 | run: | |
37 | 33 | mkdir -p storage/app/htmlpurifier |
38 | 34 | chmod -R 775 storage/app/htmlpurifier |
39 | 35 |
|
40 | | - # Step 5: Install Dependencies |
41 | 36 | - name: Install Dependencies |
42 | 37 | working-directory: ./backend |
43 | 38 | run: composer install --no-dev --no-progress --no-scripts --optimize-autoloader |
44 | 39 |
|
45 | | - # Step 6: Install Vapor CLI |
46 | 40 | - name: Install Vapor CLI |
47 | 41 | run: composer global require laravel/vapor-cli |
48 | 42 |
|
49 | | - # Step 7: Log the branch being deployed (Optional enhancement) |
50 | 43 | - name: Log Branch |
51 | | - run: echo "Deploying branch ${{ github.ref_name }}" |
| 44 | + run: echo "Deploying branch ${{ github.ref_name }} to Vapor" |
52 | 45 |
|
53 | | - # Step 8: Deploy to the Vapor Production Environment |
54 | | - - name: Deploy to Production |
| 46 | + - name: Deploy to Vapor Production |
55 | 47 | working-directory: ./backend |
56 | 48 | run: vapor deploy production |
57 | 49 | env: |
58 | 50 | VAPOR_API_TOKEN: ${{ secrets.VAPOR_API_TOKEN }} |
| 51 | + |
| 52 | + frontend: |
| 53 | + name: Deploy Frontend |
| 54 | + runs-on: ubuntu-latest |
| 55 | + needs: backend |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v2 |
| 59 | + |
| 60 | + - name: Deploy to DigitalOcean App Platform |
| 61 | + run: | |
| 62 | + curl -X POST "https://api.digitalocean.com/v2/apps/${{ secrets.DIGITALOCEAN_PRODUCTION_APP_ID }}/deployments" \ |
| 63 | + -H "Authorization: Bearer ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}" \ |
| 64 | + -H "Content-Type: application/json" |
0 commit comments