Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/main_todo-python-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build and deploy Python app to Azure Web App - todo-python-api

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
working-directory: src/api

- name: Install dependencies
run: pip install -r requirements.txt
working-directory: src/api

# Optional: Add step to run tests here

- name: Zip artifact for deployment
run: zip release.zip ./* -r
working-directory: src/api

- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: src/api/release.zip

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
contents: read

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app

- name: Unzip artifact for deployment
run: unzip release.zip

- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_1E12482F18E24062ADAA1F4BD6B29335 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_3276D62CD33C40D2A069B91CDD6176BC }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_5BF9C6F332B048678FDDF03501410E3D }}

- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: 'todo-python-api'
slot-name: 'Production'
67 changes: 67 additions & 0 deletions .github/workflows/main_todo-react-web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build and deploy React app to Azure Web App - todo-react-web

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Install dependencies
run: npm install
working-directory: src/web

- name: Build
run: npm run build
working-directory: src/web

- name: Check dist folder exists
run: |
if [ ! -d "src/web/dist" ]; then
echo "Dist folder not found! Build step failed."
exit 1
fi

- name: Zip dist folder
run: zip -r dist.zip dist
working-directory: src/web

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: src/web/dist.zip

- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Unzip artifact for deployment
run: unzip dist.zip

- name: Login to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.LASTTODOAPP }}
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
with:
app-name: 'todo-react-web'
slot-name: 'Production'
package: dist