Skip to content

Merge branch 'master' of https://github.com/oigbokwe73/Azure-Service-… #39

Merge branch 'master' of https://github.com/oigbokwe73/Azure-Service-…

Merge branch 'master' of https://github.com/oigbokwe73/Azure-Service-… #39

# 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 - training20240830
on:
push:
branches:
- master
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './AzureServiceBusToSQL' # 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
jobs:
build-deploy-function-app:
if: false
runs-on: windows-latest
permissions:
id-token: write #This is required for requesting the JWT
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_2607E41FB02C4860B248ABE4785E2B15 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_A6244A728DA148E8858A64F34ABB7D0D }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4844BD43655F4ECA9FE9AA32324B7833 }}
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: 'training20240830'
slot-name: 'Production'
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
build-and-deploy-config-files:
runs-on: ubuntu-latest
permissions:
id-token: write #This is required for requesting the JWT
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_2607E41FB02C4860B248ABE4785E2B15 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_A6244A728DA148E8858A64F34ABB7D0D }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4844BD43655F4ECA9FE9AA32324B7833 }}
- name: Retrieve Storage Account Key using Managed Identity
uses: Azure/cli@v1
with:
inlineScript: |
ACCOUNT_KEY=$(az storage account keys list --account-name ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }} --resource-group 'training20240830' --query [0].value --output tsv)
echo "ACCOUNT_KEY=${ACCOUNT_KEY}" >> $GITHUB_ENV
- name: Write config Files To Storage Account Container
uses: Azure/cli@v1
with:
inlineScript: |
az storage blob upload-batch \
--account-name ${{ secrets.AZURE_STORAGE_ACCOUNT_NAME }} \
--account-key $ACCOUNT_KEY \
--source ./AzureServiceBusToSQL/Config \
--destination ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }} \
--overwrite true