Skip to content

modifying events, networking #30

modifying events, networking

modifying events, networking #30

Workflow file for this run

name: github-actions
on:
pull_request:
branches:
- 'main'
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
AZURE_FUNCTIONAPP_NAME: ${{ secrets.AZURE_FUNCTIONAPP_NAME }}
AZURE_FUNCTIONAPP_PACKAGE_PATH: "function/"
NODE_VERSION: "20"
PYTHON_VERSION: "3.9"
jobs:
apply:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Initialize Terraform
run: terraform init
- name: Format
run: terraform fmt
- name: Validate
run: terraform validate
- name: Plan
if: github.event_name == 'pull_request'
run: terraform plan
- name: Apply
run: terraform apply -auto-approve
function:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Publish Profile
id: get_publish_profile
uses: azure/CLI@v1
with:
inlineScript: |
az login --service-principal -u ${{ secrets.ARM_CLIENT_ID }} -p ${{ secrets.ARM_CLIENT_SECRET }} --tenant ${{ secrets.ARM_TENANT_ID }}
az account set --subscription ${{ secrets.ARM_SUBSCRIPTION_ID }}
PUBLISHPROFILE=$(az webapp deployment list-publishing-profiles --resource-group "rg-academy2024-anssihakanen" --name "fa-academyanssihakanen-dev-001" --xml)
echo "::add-mask::$PUBLISHPROFILE"
echo "publish_profile=$PUBLISHPROFILE" >> "$GITHUB_OUTPUT"
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: "Resolve Project Dependencies Using pip"
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
pip install --upgrade pip
pip install --target=".python_packages/lib/site-packages" -r requirements.txt
popd
- name: "Run Azure Functions Action"
uses: Azure/[email protected]
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ./${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ steps.get_publish_profile.outputs.publish_profile }}