Spaces:
Runtime error
Runtime error
Upload newdocker_download_update.yml
Browse files
newdocker_download_update.yml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build & Deploy
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- master
|
7 |
+
schedule:
|
8 |
+
- cron: '0 * * * *' # This will make the workflow run every hour
|
9 |
+
|
10 |
+
jobs:
|
11 |
+
update-from-blob:
|
12 |
+
runs-on: ubuntu-latest
|
13 |
+
steps:
|
14 |
+
- name: 'Checkout GitHub Action'
|
15 |
+
uses: actions/checkout@v2
|
16 |
+
|
17 |
+
- name: 'Download Blob from Azure Storage'
|
18 |
+
uses: wbkcode/WarbaBotf@master
|
19 |
+
with:
|
20 |
+
connection-string: ${{ secrets.AZURE_BLOB_CONNECTION_STRING }}
|
21 |
+
container-name: "warbadataset"
|
22 |
+
blob-name: "data.csv"
|
23 |
+
download-path: "."
|
24 |
+
|
25 |
+
- name: 'Commit and push'
|
26 |
+
run: |
|
27 |
+
git config --local user.email "[email protected]"
|
28 |
+
git config --local user.name "GitHub Action"
|
29 |
+
git add data.csv
|
30 |
+
git commit -m "Updated data.csv from Azure Blob Storage" || echo "No changes to commit"
|
31 |
+
git push
|
32 |
+
|
33 |
+
build-and-deploy:
|
34 |
+
needs: update-from-blob
|
35 |
+
runs-on: ubuntu-latest
|
36 |
+
steps:
|
37 |
+
- name: 'Checkout GitHub Action'
|
38 |
+
uses: actions/checkout@main
|
39 |
+
|
40 |
+
- name: 'Login to Azure CLI'
|
41 |
+
uses: azure/login@v1
|
42 |
+
with:
|
43 |
+
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
44 |
+
|
45 |
+
- name: 'Build and Push Docker Image'
|
46 |
+
uses: azure/docker-login@v1
|
47 |
+
with:
|
48 |
+
login-server: botapp.azurecr.io
|
49 |
+
username: ${{ secrets.REGISTRY_USERNAME }}
|
50 |
+
password: ${{ secrets.REGISTRY_PASSWORD }}
|
51 |
+
- run: |
|
52 |
+
docker build -t botapp.azurecr.io/app:${{ github.sha }} .
|
53 |
+
docker push botapp.azurecr.io/app:${{ github.sha }}
|
54 |
+
|
55 |
+
- name: Deploy to Azure Web App
|
56 |
+
id: deploy-to-webapp
|
57 |
+
uses: azure/webapps-deploy@v2
|
58 |
+
with:
|
59 |
+
app-name: WarbaBot
|
60 |
+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
61 |
+
images: 'botapp.azurecr.io/app:${{ github.sha }}'
|