Deploy_To_Dev_Function_On_Push #1254
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_To_Dev_Function_On_Push | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
- '**/README.md' # don't run on README.md file updates anywhere in repo | |
- '**/dependabot.yml' | |
branches: | |
- develop | |
schedule: | |
- cron: '21 04 * * *' # 0421am daily | |
env: | |
STAGE: dev # 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.DEV_AZURE_CREDENTIALS }} | |
API_KEY: ${{ secrets.DEV_FLATTENER_API_KEY }} | |
jobs: | |
should_run: | |
uses: IATI/.github/.github/workflows/should_run.yaml@main | |
build_save: | |
needs: should_run | |
if: ${{ needs.should_run.outputs.should_run == 'true' }} | |
uses: IATI/.github/.github/workflows/build_node_save.yaml@main | |
with: | |
save_artifact: true | |
artifact_name: build-artifact-dev | |
deploy: | |
needs: build_save | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifact-dev | |
- name: Unzip build artifact | |
run: | | |
unzip build-artifact-dev.zip | |
rm build-artifact-dev.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-dev.postman_environment.json \ | |
--working-dir integration-tests/test-files \ | |
--env-var keyValue=$API_KEY | |
# Mark status checks success/fail on dependabot commits for scheduled deploys | |
status_check_success: | |
needs: [deploy, integration-test] | |
if: success() && github.event_name == 'schedule' | |
uses: IATI/.github/.github/workflows/status_check_success.yaml@main | |
status_check_failure: | |
needs: [deploy, integration-test] | |
if: failure() && github.event_name == 'schedule' | |
uses: IATI/.github/.github/workflows/status_check_failure.yaml@main |