[NOD-473] fix: updated action versions #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Azure function | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
description: The name of the environment where to deploy | ||
type: string | ||
target: | ||
required: true | ||
description: The environment target of the job | ||
type: string | ||
resource_group: | ||
required: true | ||
description: The resource group of the function to deploy | ||
type: string | ||
app_name: | ||
required: true | ||
description: The name of the function to deploy | ||
type: string | ||
registry_image: | ||
required: true | ||
description: The name of the image from container registry to be used | ||
type: string | ||
permissions: | ||
id-token: write | ||
contents: read | ||
jobs: | ||
# Starting the Azure Function's staging slot, if deploying in PROD | ||
start_staging_slot: | ||
name: Create staging slots | ||
runs-on: ubuntu-22.04 | ||
if: ${{ inputs.target == inputs.environment && inputs.target == 'prod' }} | ||
environment: | ||
name: ${{ inputs.environment }} | ||
uses: pagopa/github-actions-template/azure-function-start-staging-slot@ff1d20edd8236ade3cb06020c273292b9a62d391 | ||
with: | ||
branch: ${{ github.ref_name }} | ||
client_id: ${{ secrets.CLIENT_ID }} | ||
tenant_id: ${{ secrets.TENANT_ID }} | ||
subscription_id: ${{ secrets.SUBSCRIPTION_ID }} | ||
resource_group: ${{ inputs.resource_group }} | ||
app_name: ${{ inputs.app_name }} | ||
registry_image: ${{ inputs.registry_image }} | ||
# Executing the deploy of the Azure function with the new image | ||
deploy: | ||
name: Deploy Azure Function | ||
runs-on: ubuntu-22.04 | ||
needs: [ create_staging_slot ] | ||
environment: | ||
name: ${{ inputs.environment }} | ||
uses: pagopa/github-actions-template/azure-function-deploy@ff1d20edd8236ade3cb06020c273292b9a62d391 | ||
with: | ||
branch: ${{ github.ref_name }} | ||
client_id: ${{ secrets.CLIENT_ID }} | ||
tenant_id: ${{ secrets.TENANT_ID }} | ||
subscription_id: ${{ secrets.SUBSCRIPTION_ID }} | ||
app_name: ${{ inputs.app_name }} | ||
registry_image: ${{ inputs.registry_image }} | ||
# Stopping the Azure Function's staging slot, if deploying in PROD | ||
stop_staging_slot: | ||
name: Clean staging slots | ||
needs: [ create_staging_slot, deploy ] | ||
if: ${{ success() || failure() && (inputs.target == inputs.environment && inputs.target == 'prod') }} | ||
runs-on: ubuntu-22.04 | ||
environment: | ||
name: ${{ inputs.environment }} | ||
uses: pagopa/github-actions-template/azure-function-stop-staging-slot@ff1d20edd8236ade3cb06020c273292b9a62d391 | ||
with: | ||
branch: ${{ github.ref_name }} | ||
client_id: ${{ secrets.CLIENT_ID }} | ||
tenant_id: ${{ secrets.TENANT_ID }} | ||
subscription_id: ${{ secrets.SUBSCRIPTION_ID }} | ||
resource_group: ${{ inputs.resource_group }} | ||
app_name: ${{ inputs.app_name }} | ||
registry_image: ${{ inputs.registry_image }} |