- Notifications
You must be signed in to change notification settings - Fork5.9k
Dev1#106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
stacyhaha wants to merge21 commits intomicrosoft:mainChoose a base branch fromstacyhaha:dev1
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Dev1#106
Changes fromall commits
Commits
Show all changes
21 commits Select commitHold shift + click to select a range
119ecab
Add or update the Azure App Service build and deployment workflow config
stacyhahae1dce68
change the home page
70a5674
check main protection
ec31e47
v3 check protection
5ad0ab7
avoid bypass
6436b19
Create docker.yaml
stacyhaha0cbbafd
Rename docker.yaml to docker.yml
stacyhaha73d7351
Update docker.yml
stacyhahac20c1a5
从 Azure 门户添加或更新应用服务部署工作流配置。
stacyhaha844f5e9
从 Azure 门户添加或更新应用服务部署工作流配置。
stacyhaha97f2b79
Update dev1_cicd-docker.yml
stacyhaha01f7ad8
Update dev1_cicd-docker.yml
stacyhaha4b0d6fc
Update dev1_cicd-docker.yml
stacyhaha0435111
从 Azure 门户添加或更新应用服务部署工作流配置。
stacyhaha969e10d
从 Azure 门户添加或更新应用服务部署工作流配置。
stacyhahaaabadfe
Update dev1_cicd-docker.yml
stacyhaha2680187
Update dev1_docker-cicd.yml
stacyhaha5e10f7c
Update dev1_docker-cicd.yml
stacyhahacc24579
Update dev1_docker-cicd.yml
stacyhaha66b278b
Update dev1_docker-cicd.yml
stacyhaha4f8a3e9
Update dev1_docker-cicd.yml
stacyhahaFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions.github/workflows/dev1_cicd-docker.yml
This file contains hidden or 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,54 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
name: Build and deploy container app to Azure Web App - cicd-docker | ||
on: | ||
push: | ||
branches: | ||
- dev1 | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Log in to registry | ||
uses: docker/login-action@v3.3.0 | ||
with: | ||
registry: https://ghcr.io/ | ||
username: ${{ secrets.AzureAppService_ContainerUsername_0662e63fa3694eeebfb3e991e27936ca }} | ||
password: ${{ secrets.AzureAppService_ContainerPassword_8e51194ff5ea4c38b91386c854241fbe }} | ||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ secrets.AzureAppService_ContainerUsername_0662e63fa3694eeebfb3e991e27936ca }}/appsvc/staticsite:${{ github.sha }} | ||
file: ./Dockerfile | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: 'production' | ||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
steps: | ||
- name: Deploy to Azure Web App | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'cicd-docker' | ||
slot-name: 'production' | ||
publish-profile: ${{ secrets.AzureAppService_PublishProfile_6074368e92f4496ebf08ec0f8238e59f }} | ||
images: 'ghcr.io/${{ secrets.AzureAppService_ContainerUsername_0662e63fa3694eeebfb3e991e27936ca }}/appsvc/staticsite:${{ github.sha }}' |
53 changes: 53 additions & 0 deletions.github/workflows/dev1_docker-cicd.yml
This file contains hidden or 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,53 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
name: Build and deploy container app to Azure Web App - docker-cicd | ||
on: | ||
push: | ||
branches: | ||
- dev1 | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Log in to registry | ||
uses: docker/login-action@v3.3.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.AzureAppService_ContainerUsername_70e6045170104b8997d27697b11cdfd0 }} | ||
password: ${{ secrets.AzureAppService_ContainerPassword_4e4dafdefa504043a4aada246d62cf72 }} | ||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
tags: ghcr.io/stacyhaha/python-sample-vscode-flask-tutorial/myapp:${{ github.sha }} | ||
file: ./Dockerfile | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: 'production' | ||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
steps: | ||
- name: Deploy to Azure Web App | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: 'docker-cicd' | ||
slot-name: 'production' | ||
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e90c69f2bc964901a9a6348a135e00d5 }} | ||
images: 'ghcr.io/${{ secrets.AzureAppService_ContainerUsername_70e6045170104b8997d27697b11cdfd0 }}/appsvc/staticsite:${{ github.sha }}' |
70 changes: 70 additions & 0 deletions.github/workflows/docker.yml
This file contains hidden or 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,70 @@ | ||
# 此工作流使用未经 GitHub 认证的操作。 | ||
# 它们由第三方提供,并受 | ||
# 单独的服务条款、隐私政策和支持 | ||
# 文档。 | ||
# GitHub 建议将操作固定到提交 SHA。 | ||
# 若要获取较新版本,需要更新 SHA。 | ||
# 还可以引用标记或分支,但该操作可能会更改而不发出警告。 | ||
name: Build and deploy a container to an Azure Web App | ||
env: | ||
AZURE_WEBAPP_NAME: cicd-docker # set this to your application's name | ||
on: | ||
push: | ||
branches: | ||
- dev1 | ||
permissions: | ||
contents: 'read' | ||
packages: 'write' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b | ||
- name: Log in to GitHub container registry | ||
uses: docker/login-action@8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Lowercase the repo name | ||
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ env.REPO }}:${{ github.sha }} | ||
file: ./Dockerfile | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: 'production' | ||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
steps: | ||
- name: Lowercase the repo name | ||
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | ||
- name: Deploy to Azure Web App | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c | ||
with: | ||
app-name: ${{ env.AZURE_WEBAPP_NAME }} | ||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DOCKER }} | ||
images: 'ghcr.io/${{ env.REPO }}:${{ github.sha }}' |
78 changes: 78 additions & 0 deletions.github/workflows/main_cicd-demo.yml
This file contains hidden or 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,78 @@ | ||
# 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 - cicd-demo | ||
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@v5 | ||
with: | ||
python-version: '3.8' | ||
- 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 | ||
- name: Upload artifact for deployment jobs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-app | ||
path: | | ||
release.zip | ||
!venv/ | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: 'Production' | ||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
permissions: | ||
id-token: write #This is required for requesting the JWT | ||
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_5FB268B98CFE44E0BEEED5F540A2839B }} | ||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_3EBFE7E2825942458DDF8947751539A7 }} | ||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4C16A9EE9B4845589A178E3565C8667A }} | ||
- name: 'Deploy to Azure Web App' | ||
uses: azure/webapps-deploy@v3 | ||
id: deploy-to-webapp | ||
with: | ||
app-name: 'cicd-demo' | ||
slot-name: 'Production' | ||
2 changes: 1 addition & 1 deletionhello_app/templates/home.html
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.