|
15 | 15 |
|
16 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 17 | jobs: |
18 | | - # This workflow contains a single job called "build-and-deploy:" |
19 | | - build-and-deploy: |
20 | | - # The type of runner that the job will run on |
| 18 | + build: |
21 | 19 | runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
22 | 22 |
|
23 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
| 23 | + - name: Build Docker Image |
| 24 | + run: docker build -t mealplan:staging . |
| 25 | + |
| 26 | + - name: Run Tests |
| 27 | + run: | |
| 28 | + echo "Running tests..." |
| 29 | + # Replace with your actual test command, e.g. pytest, npm test, etc. |
| 30 | + echo "Tests passed!" |
| 31 | +
|
| 32 | + deploy: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: build |
24 | 35 | steps: |
25 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
26 | 36 | - uses: actions/checkout@v4 |
27 | 37 |
|
28 | | - - name: Docker |
| 38 | + - name: Deploy to Staging |
29 | 39 | run: | |
30 | | - docker build -t mealplan:staging . |
31 | | - echo "Stoppe alte Container falls vorhanden..." |
| 40 | + echo "Stopping old containers..." |
32 | 41 | docker compose down || true |
33 | | - echo "Starte neue Container..." |
| 42 | + echo "Starting new containers..." |
34 | 43 | docker compose up -d --force-recreate |
35 | | - echo "Deployment abgeschlossen" |
36 | | - docker compose logs --tail=50 |
| 44 | + echo "Deployment finished" |
| 45 | + docker logs webserver > deployment.log |
| 46 | +
|
| 47 | + - name: Upload Deployment Logs |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: deployment-logs |
| 51 | + path: deployment.log |
0 commit comments