Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/prod_workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
######### Prod Workflow ########
on:
pull_request:
branches: [main]
types:
- closed
workflow_dispatch:
permissions:
id-token: write
contents: read

jobs:
Build:
environment: Production
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_DOMAIN }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Publish image to Azure Registry
run: |
docker build -t ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }} -t ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.ref_name == 'master' && 'prod' || github.ref_name }}${{ github.ref_name != 'master' && '-latest' || 'latest' }} .
docker push ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }} --all-tags
Deploy:
needs: Build
environment:
name: Production
runs-on: ubuntu-latest
steps:
- name: Login to Azure
uses: azure/login@v2.0.0
with:
creds: ${{secrets.TDEI_CORE_AZURE_CREDS}}
- name: Deploy to Production
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
images: ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }}.