Skip to content

Commit

Permalink
优化 Azure App Service 部署工作流,排除 venv 目录并保留 requirements.txt 文件
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Oct 31, 2024
1 parent 7b2fa37 commit 18b356c
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/main_gptservice.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build and deploy Python app to Azure Web App - gptservice

on:
Expand All @@ -22,25 +18,17 @@ jobs:
with:
python-version: '3.11'

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: pip install -r requirements.txt

# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
- name: Zip artifact for deployment
run: zip release.zip ./* -r
run: zip release.zip ./* -r -x "venv/*" # 排除 venv 目录

- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v3
with:
name: python-app
path: |
release.zip
!venv/
requirements.txt # 保留 requirements.txt 文件,以便 Azure 安装依赖
deploy:
runs-on: ubuntu-latest
Expand All @@ -64,4 +52,4 @@ jobs:
with:
app-name: 'gptservice'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_8514836F786A4D5395C6FB93A53E6D5B }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_8514836F786A4D5395C6FB93A53E6D5B }}

0 comments on commit 18b356c

Please sign in to comment.