Skip to content

Deploy

Deploy #132

Workflow file for this run

name: "Deploy"
on: [workflow_dispatch]
jobs:
deploy:
name: deploy
runs-on: ubuntu-20.04 # Match main.yml
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Image
run: |
docker build -f "src/OrderBot/Dockerfile" . --tag ${{ secrets.REGISTRY_LOGIN_SERVER }}/bgsorderbot:${{ github.sha }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/bgsorderbot:${{ github.sha }}
- name: Deploy to Azure Container Instances
uses: azure/aci-deploy@v1
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ secrets.RESOURCE_GROUP }}${{ github.run_number }} # Required even when not exposing ports
image: ${{ secrets.REGISTRY_LOGIN_SERVER }}/bgsorderbot:${{ github.sha }}
registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
registry-username: ${{ secrets.REGISTRY_USERNAME }}
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
name: ci-bgsorderbot
secure-environment-variables: ConnectionStrings__OrderBot="${{ secrets.SQL_CONNECTION_STRING }}" Discord__ApiKey="${{ secrets.DISCORD_APIKEY }}" LogAnalytics__WorkspaceId="${{ secrets.LOG_ANALYTICS_WORKSPACE }}" LogAnalytics__WorkspaceKey="${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}"
location: australiaeast
memory: 1
cpu: 1
os-type: Linux
# Log to Log Analytics directly
# log-analytics-workspace: ${{ secrets.LOG_ANALYTICS_WORKSPACE }}
# log-analytics-workspace-key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}