Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created November 4, 2020 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/d806e47efde7749c6154b19f081f86d2 to your computer and use it in GitHub Desktop.
Save justinyoo/d806e47efde7749c6154b19f081f86d2 to your computer and use it in GitHub Desktop.
Deploying Azure Functions via GitHub Actions without Publish Profile
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
...
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Login via Az Module
uses: azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}
enable-AzPSSession: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
...
- name: Get publish Profile
id: fncapp
shell: pwsh
run: |
$profile = Get-AzWebAppPublishingProfile `
-ResourceGroupName ${{ secrets.RESOURCE_GROUP_NAME }} `
-Name ${{ secrets.FUNCTION_APP_NAME }}
$profile = $profile.Replace("`r", "").Replace("`n", "")
Write-Output "::set-output name=profile::$profile"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
...
- name: Get publish Profile
id: fncapp
...
- name: Show publish profile
shell: pwsh
run: |
echo ${{ steps.fncapp.outputs.profile }}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
...
- name: Reset publish Profile
shell: pwsh
run: |
$profile = Reset-AzWebAppPublishingProfile `
-ResourceGroupName ${{ secrets.RESOURCE_GROUP_NAME }} `
-Name ${{ secrets.FUNCTION_APP_NAME }}
$profile = ""
name: Build, Test & Deploy
on: push
jobs:
build_test_deploy:
name: 'FunctionApp Build, Test & Deploy'
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
...
- name: Get FunctionApp publish profile
id: publishprofile
uses: aliencube/publish-profile-actions@v1
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS_DEV }}
with:
resourceGroupName: ${{ secrets.RESOURCE_GROUP_NAME_DEV }}
appName: ${{ secrets.RESOURCE_FUNCTIONAPP_NAME_DEV }}
- name: Deploy FunctionApp
uses: Azure/functions-action@v1
with:
app-name: ${{ secrets.RESOURCE_FUNCTIONAPP_NAME_DEV }}
package: published
publish-profile: ${{ steps.publishprofile.outputs.profile }}
- name: Reset FunctionApp publish profile
uses: aliencube/publish-profile-actions@v1
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS_DEV }}
with:
resourceGroupName: ${{ secrets.RESOURCE_GROUP_NAME_DEV }}
appName: ${{ secrets.RESOURCE_FUNCTIONAPP_NAME_DEV }}
reset: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment