Skip to content
name: Deploy_To_PROD_Function_On_Release
# Runs when a Release is published from GitHub UI
on:
release:
types: [published]
env:
STAGE: prod # prefix to indicate environment stage
NAME: func-iatiflattener
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
AZURE_CREDENTIALS: ${{ secrets.PROD_AZURE_CREDENTIALS }}
API_KEY: ${{ secrets.PROD_FLATTENER_API_KEY }}
jobs:
build_save:
uses: IATI/.github/.github/workflows/build_node_save.yaml@main
with:
save_artifact: true
artifact_name: build-artifact-prod
deploy:
needs: build_save
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build-artifact-prod
- name: Unzip build artifact
run: |
unzip build-artifact-prod.zip
rm build-artifact-prod.zip
- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ env.AZURE_CREDENTIALS }} # Service Principal credentials saved in GitHub Secrets
- name: Set Env variables
uses: Azure/[email protected]
with:
app-name: ${{ env.NAME }}-${{ env.STAGE }}
app-settings-json: |
[
{
"name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "~16",
"slotSetting": false
}
]
- name: 'Run Azure Functions Action'
uses: Azure/[email protected]
with:
app-name: ${{ env.NAME }}-${{ env.STAGE }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
respect-funcignore: true
integration-test:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: 'Install newman'
run: |
sudo npm i -g newman
- name: 'Run integration tests'
run: |
newman run integration-tests/iati-flattener-integration-tests.postman_collection.json \
-e integration-tests/envs/func-iatiflattener-prod.postman_environment.json \
--working-dir integration-tests/test-files \
--env-var keyValue=$API_KEY