-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: add a workflow to deploy to Azure
The workflow conditionally executes the deploy stage, deploying to staging and production environments from `dev` and `main` branches respectively.
- Loading branch information
1 parent
52b207d
commit d1e80e7
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow conditionally deploys the application to either a staging or production environment, | ||
# depending on the branch that triggers it. | ||
|
||
name: Build and deploy Python app to Azure Web App | ||
|
||
env: | ||
PYTHON_VERSION: '3.11' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python version | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: 'pip' | ||
|
||
- name: Create and start virtual environment | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
- name: Install dependencies | ||
run: pip install -r requirements.txt | ||
|
||
- name: 'Deploy to Azure Web App - Staging' | ||
if: github.ref == 'refs/heads/dev' | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'ftss-api-dev' | ||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }} | ||
|
||
- name: 'Deploy to Azure Web App - Production' | ||
if: github.ref == 'refs/heads/main' | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'ftss-api' | ||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_MAIN }} |