添加 Redis 缓存功能,支持缓存设置、获取和删除;实现 Azure Blob 存储上传和下载功能;新增 md5 哈希函数;更新 API… #14
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
name: Build and deploy Python app to Azure Web App - apiservice | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python version | |
uses: actions/setup-python@v1 | |
with: | |
python-version: '3.11' | |
- name: Zip artifact for deployment | |
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 | |
requirements.txt # 包含 requirements.txt | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Download artifact from build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-app | |
- name: Unzip artifact for deployment | |
run: unzip release.zip | |
- name: 'Deploy to Azure Web App' | |
uses: azure/webapps-deploy@v2 | |
id: deploy-to-webapp | |
with: | |
app-name: 'apiservice' | |
slot-name: 'Production' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_50B8C74D8E9241449F3BD6D9AF12FBD1 }} |