-
Notifications
You must be signed in to change notification settings - Fork 87
55 lines (47 loc) · 2.21 KB
/
reports.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Reports
on:
push:
branches:
- 'reports/**'
- 'develop'
jobs:
CancelPrevious:
runs-on: ubuntu-latest
steps:
- name: Cancel Old Pipeline
uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BuildNDeployReports:
needs: [CancelPrevious]
if: ${{ github.event.repository.owner.login == 'intershop' }}
runs-on: ubuntu-latest
environment:
name: PWA Reports
url: https://pwa-gh-review-reports.azurewebsites.net
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Reset .dockerignore
run: echo node_modules > .dockerignore
- name: Publish Reports Image to Registry
id: reports
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: reports
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
dockerfile: Dockerfile_reports
- name: Set Environment
run: |
echo "DOCKER_IMAGE_REPORTS=${{ steps.reports.outputs.digest }}" >> $GITHUB_ENV
- name: Login to Azure
run: az login --service-principal --username ${{ secrets.AZURE_SP_USERNAME }} --password ${{ secrets.AZURE_SP_PASSWORD }} --tenant ${{ secrets.AZURE_SP_TENANT }}
- name: Create or Update Reports App Service
env:
APP: '${{ secrets.AZURE_DEMO_RESOURCEGROUP }}-reports'
GROUP: ${{ secrets.AZURE_DEMO_RESOURCEGROUP }}
run: |
az webapp config container set --resource-group $GROUP --name $APP --docker-registry-server-user ${{ secrets.DOCKER_REGISTRY_USERNAME }} --docker-registry-server-password ${{ secrets.DOCKER_REGISTRY_PASSWORD }} --docker-custom-image-name $DOCKER_IMAGE_REPORTS || az webapp create --resource-group $GROUP --plan ${{ secrets.AZURE_DEMO_APPSERVICEPLAN }} --name $APP --docker-registry-server-user ${{ secrets.DOCKER_REGISTRY_USERNAME }} --docker-registry-server-password ${{ secrets.DOCKER_REGISTRY_PASSWORD }} --deployment-container-image-name $DOCKER_IMAGE_REPORTS
az webapp deployment container config -g $GROUP -n $APP --enable-cd true