Skip to content

Update master_training20250205.yml #7

Update master_training20250205.yml

Update master_training20250205.yml #7

# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy dotnet core app to Azure Function App - training20250205
on:
push:
branches:
- master
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use
AZURE_STORAGE_ACCOUNT: 'training20250205'
AZURE_STORAGE_CONTAINER: 'config'
SOURCE_FOLDER: './config' # Change this to your folder path
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8A0791B3BFAD487D8BBD6B34324B6F4B }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_0BC0EE63700541308905A13F2D0A0B85 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_E0D657C2E0634D47A689BECBAA812924 }}
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'training20250205'
slot-name: 'Production'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
- name: Azure CLI Action
uses: Azure/cli@v2.1.0
with:
inlineScript: |
echo "Uploading files to Azure Storage Container..."
az storage blob upload-batch \
--account-name ${{ env.AZURE_STORAGE_ACCOUNT }} \
--destination ${{ env.AZURE_STORAGE_CONTAINER }} \
--source ${{ env.SOURCE_FOLDER }} \
--pattern "*" --overwrite