Skip to content

Commit c468ab1

Browse files
authored
Created prod workflow (#23)
1 parent f84ad99 commit c468ab1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
######### Prod Workflow ########
3+
on:
4+
pull_request:
5+
branches: [main]
6+
types:
7+
- closed
8+
workflow_dispatch:
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
Build:
15+
environment: Production
16+
runs-on: ubuntu-latest
17+
if: github.event.pull_request.merged == true
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: azure/docker-login@v1
21+
with:
22+
login-server: ${{ secrets.REGISTRY_DOMAIN }}
23+
username: ${{ secrets.REGISTRY_USERNAME }}
24+
password: ${{ secrets.REGISTRY_PASSWORD }}
25+
- name: Publish image to Azure Registry
26+
run: |
27+
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' }} .
28+
docker push ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }} --all-tags
29+
Deploy:
30+
needs: Build
31+
environment:
32+
name: Production
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Login to Azure
36+
uses: azure/login@v2.0.0
37+
with:
38+
creds: ${{secrets.TDEI_CORE_AZURE_CREDS}}
39+
- name: Deploy to Production
40+
uses: azure/webapps-deploy@v2
41+
with:
42+
app-name: ${{ secrets.AZURE_WEBAPP_NAME }}
43+
images: ${{ secrets.REGISTRY_DOMAIN }}/${{ secrets.REGISTRY_REPO }}:${{ github.sha }}.

0 commit comments

Comments
 (0)