Trigger auto deployment #15
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: Trigger auto deployment | |
# When this action will be executed | |
on: | |
# Uncomment the code below for automatically trigger the workflow when detected changes in the main branch | |
push: | |
branches: [main] | |
# Allow manual trigger | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: [sb1u] | |
steps: | |
- name: Checkout to the branch | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install Azure CLI | |
run: pip install azure-cli | |
# - name: Set up Postgresql with prisma | |
# run: | | |
# DATABASE_URL=${{secrets.DATABASE_URL}} npx prisma generate | |
# DATABASE_URL=${{secrets.DATABASE_URL}} npx prisma migrate deploy | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Build and push container image to registry | |
uses: azure/container-apps-deploy-action@v1 | |
with: | |
appSourcePath: ${{ github.workspace }} | |
registryUrl: sbukrokeloneacr.azurecr.io | |
registryUsername: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
registryPassword: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
imageToBuild: sbukrokeloneacr.azurecr.io/krokelo:${{ github.sha }} |