@Wonderful World there shouldn't continuous deployment You should be able to leverage this example workflow file as your GitHub action. Once your pipeline builds the project, the Azure/functions-action@v1
task will deploy your artifacts to your function app and the platform will recognize the function.json
.
If you're having deployment issues, please feel free to share the errors that you're receiving in a comment down below.
EDIT 28 Aug: Based off the comments down below, you want to go down the Infrastructure as Code path. You can achieve this using GitHub actions. This blog post is a good example of how to implement the basic structure. You would build
step will build your application, publish those artifacts along with your IaC.
build:
name: build phase
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build and Publish app
run: dotnet publish ./webapp/ --configuration Release /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary
- name: Publish app artifact
uses: actions/upload-artifact@v3
with:
name: app
path: "./webapp/bin/Release/net6.0/publish/"
- name: Publish Infra artifact
uses: actions/upload-artifact@v3
with:
name: infra
path: "./Infra/"
Next you, use deployDevInfrastructure
that's mentioned in the blog post to execute your infrastructure code. This assumes your IaC code is a folder named
deployDevInfrastructure:
needs: build
name: deploy dev infrastructure
runs-on: ubuntu-latest
steps:
- name: Download infra
uses: actions/download-artifact@v3
with:
name: infra
path: infra
- name: Login to Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy infrastructure
id: azure-deployment
shell: pwsh
run: |
$rgName = '${{ env.RG_NAME }}'
$(az deployment create --name $rgName `
--location ${{ env.LOCATION }} `
--template-file main.bicep `
--parameters location=${{ env.LOCATION }} `
--parameters rgName=$rgName `
--output json) | ConvertFrom-Json
working-directory: ./infra/
You'll notice that --template-file
refers to a main.bicep
. If you want to use ARM, you would reference your ARM template file. Running the az deployment create
command is what takes your IaC code and deploys
From this end of the CI/CD pipeline, you don't really need concern with source control because you're using the pipeline to push the code to the PaaS. Source control comes into play if you were using PaaS to pull the code from a repository.
The next step is deploying the app once the infrastructure has been deployed.
deployDevApp:
needs: deployDevInfrastructure
name: deploy dev application
runs-on: ubuntu-latest
steps:
- name: Download app
uses: actions/download-artifact@v3
with:
name: app
path: app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: '${{ needs.deployDevInfrastructure.outputs.appName }}'
slot-name: 'Production'
publish-profile: ${{ needs.deployDevInfrastructure.outputs.publishProfiles }}
package: ./app
The deployDevInfrastructure
uses powershell, so to gather the outputs, just set a variable name and configure it to the outputs
property.
outputs:
appName: ${{ steps.azure-deployment.outputs.appName }}
publishProfiles: ${{ steps.azure-deployment.outputs.publishProfiles }}