Shagardi_chatbot / newdocker_download_update.yml
AhmedEwis's picture
Upload newdocker_download_update.yml
87b7cea
name: Build & Deploy
on:
push:
branches:
- master
schedule:
- cron: '0 * * * *' # This will make the workflow run every hour
jobs:
update-from-blob:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v2
- name: 'Download Blob from Azure Storage'
uses: wbkcode/WarbaBotf@master
with:
connection-string: ${{ secrets.AZURE_BLOB_CONNECTION_STRING }}
container-name: "warbadataset"
blob-name: "data.csv"
download-path: "."
- name: 'Commit and push'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add data.csv
git commit -m "Updated data.csv from Azure Blob Storage" || echo "No changes to commit"
git push
build-and-deploy:
needs: update-from-blob
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- name: 'Login to Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Build and Push Docker Image'
uses: azure/docker-login@v1
with:
login-server: botapp.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build -t botapp.azurecr.io/app:${{ github.sha }} .
docker push botapp.azurecr.io/app:${{ github.sha }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: WarbaBot
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: 'botapp.azurecr.io/app:${{ github.sha }}'