Skip to content

Commit

Permalink
Update Azure App Service build and deployment workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesun committed Oct 29, 2024
1 parent 9a6182d commit 6fc7f41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/main_apiservice.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 - apiservice

on:
Expand All @@ -22,25 +18,16 @@ 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
deploy:
runs-on: ubuntu-latest
Expand All @@ -64,4 +51,4 @@ jobs:
with:
app-name: 'apiservice'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_50B8C74D8E9241449F3BD6D9AF12FBD1 }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_50B8C74D8E9241449F3BD6D9AF12FBD1 }}
8 changes: 4 additions & 4 deletions gen_apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
api_secret = os.environ.get("API_SECRET")
s = jwt.encode(
{
"uid": "gptservice",
"appid": "gptservice",
"expire_time": (datetime.now() + timedelta(days=1000)).strftime("%Y-%m-%d %H:%M:%S"),
"level": "gptservice",
"uid": "teamstools",
"appid": "teamstools",
"expire_time": (datetime.now() + timedelta(days=10000)).strftime("%Y-%m-%d %H:%M:%S"),
"level": "teamstools",
"created_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
},
api_secret,
Expand Down

0 comments on commit 6fc7f41

Please sign in to comment.