testing github action #2
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: | |
push: | |
branches: | |
- master | |
- serverless-function | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout GitHub Action' | |
uses: actions/checkout@v2 | |
- name: 'Set up Node.js' | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' # Choose the Node.js version that suits your project | |
- name: 'Install Azure Functions Core Tools' | |
run: sudo npm i -g azure-functions-core-tools@4 --unsafe-perm true | |
- name: 'Set up Python' | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' # Set your Python version here | |
- name: 'Install dependencies' | |
run: pip install -r requirements.txt | |
- name: 'Create directory and copy files' | |
run: | | |
mkdir logzio_function | |
cp host.json requirements.txt logzio_function/ | |
cp -r LogzioShipper logzio_function/ | |
- name: 'Package Function' | |
run: func pack --build-native-deps --python | |
- name: 'Zip the function app' | |
run: zip -r logzio_function.zip logzio_function | |
- name: 'Set up Azure CLI' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: 'Upload to Azure' | |
run: az storage blob upload --overwrite true --account-name logzioblobtrigger --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} -f logzio_function.zip -c eventhub -n logzio_function.zip | |
- name: 'Logout of Azure CLI' | |
run: az logout |