enhance cleanup job, apply env config and restart when swapping slots
This commit is contained in:
Родитель
41f0255675
Коммит
175a41d783
|
@ -1,36 +1,36 @@
|
|||
name: Delete a preview environment
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
SLOT_NAME: preview-${{ github.event.number }}
|
||||
|
||||
jobs:
|
||||
delete-slot:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Log into Azure CLI with service principal
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Delete slot on staging site
|
||||
run: az webapp deployment slot delete --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot $SLOT_NAME
|
||||
|
||||
delete-deployment:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Delete Deployment Environment
|
||||
uses: strumwolf/delete-deployment-environment@v2
|
||||
with:
|
||||
environment: "PR #${{ github.event.number }}"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: Delete a preview environment
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
SLOT_NAME: preview-${{ github.event.number }}
|
||||
|
||||
jobs:
|
||||
delete-slot:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Log into Azure CLI with service principal
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Delete slot on staging site
|
||||
run: az webapp deployment slot delete --resource-group ${{ vars.AZURE_RESOURCE_GROUP }} --name ${{ vars.AZURE_WEBAPP_NAME}} --slot ${{ env.SLOT_NAME }}
|
||||
|
||||
delete-deployment:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Delete Deployment Environment
|
||||
uses: strumwolf/delete-deployment-environment@v2
|
||||
with:
|
||||
environment: "PR #${{ github.event.number }}"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
onlyRemoveDeployments: true
|
|
@ -1,22 +1,31 @@
|
|||
name: Swap staging slot contents into production
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
promote-to-production:
|
||||
name: Promote to production
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: 'Production'
|
||||
url: 'https://${{ vars.AZURE_WEBAPP_NAME }}.azurewebsites.net/'
|
||||
|
||||
steps:
|
||||
- name: Log into Azure CLI with service principal
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Swap slots
|
||||
run: az webapp deployment slot swap -s ${{ vars.STAGING_SLOT_NAME }} -n ${{ vars.AZURE_WEBAPP_NAME }} -g ${{ vars.AZURE_RESOURCE_GROUP }}
|
||||
|
||||
name: Swap staging slot contents into production
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
promote-to-production:
|
||||
name: Promote to production
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: 'Production'
|
||||
url: 'https://${{ vars.AZURE_WEBAPP_NAME }}.azurewebsites.net/'
|
||||
|
||||
steps:
|
||||
- name: Log into Azure CLI with service principal
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Change docs link to prod and restart
|
||||
run: |
|
||||
az webapp config appsettings set --resource-group steeltoe --name www-steeltoe --slot Staging --settings DocsSite__BaseAddress=https://docs.steeltoe.io
|
||||
az webapp restart --resource-group steeltoe --name www-steeltoe --slot Staging
|
||||
|
||||
- name: Swap slots
|
||||
run: az webapp deployment slot swap -s ${{ vars.STAGING_SLOT_NAME }} -n ${{ vars.AZURE_WEBAPP_NAME }} -g ${{ vars.AZURE_RESOURCE_GROUP }}
|
||||
|
||||
- name: Change docs link to staging and restart
|
||||
run: |
|
||||
az webapp config appsettings set --resource-group steeltoe --name www-steeltoe --slot Staging --settings DocsSite__BaseAddress=https://docs-staging.steeltoe.io
|
||||
az webapp restart --resource-group steeltoe --name www-steeltoe --slot Staging
|
||||
|
|
Загрузка…
Ссылка в новой задаче