|
17 | 17 |
|
18 | 18 | jobs:
|
19 | 19 | build:
|
| 20 | + if: contains(github.event.pull_request.labels.*.name, 'stage') |
| 21 | + |
20 | 22 | runs-on: ubuntu-latest
|
21 | 23 |
|
22 |
| - if: contains(github.event.pull_request.labels.*.name, 'stage') |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v1 |
| 26 | + - name: npm install and build webpack |
| 27 | + run: | |
| 28 | + npm install |
| 29 | + npm run build |
| 30 | + - uses: actions/upload-artifact@master |
| 31 | + with: |
| 32 | + name: webpack artifacts |
| 33 | + path: public/ |
| 34 | + |
| 35 | + Build-Docker-Image: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + needs: build |
| 38 | + name: Build image and store in GitHub Packages |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v1 |
| 42 | + |
| 43 | + - name: Download built artifact |
| 44 | + uses: actions/download-artifact@master |
| 45 | + with: |
| 46 | + name: webpack artifacts |
| 47 | + path: public |
| 48 | + |
| 49 | + - name: create image and store in Packages |
| 50 | + uses: mattdavis0351/actions/[email protected] |
| 51 | + with: |
| 52 | + repo-token: ${{secrets.GITHUB_TOKEN}} |
| 53 | + image-name: ${{env.DOCKER_IMAGE_NAME}} |
| 54 | + |
| 55 | + Deploy-to-Azure: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + needs: Build-Docker-Image |
| 58 | + name: Deploy app container to Azure |
| 59 | + steps: |
| 60 | + - name: "Login via Azure CLI" |
| 61 | + uses: azure/login@v1 |
| 62 | + with: |
| 63 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 64 | + |
| 65 | + - uses: azure/docker-login@v1 |
| 66 | + with: |
| 67 | + login-server: ${{env.IMAGE_REGISTRY_URL}} |
| 68 | + username: ${{ github.actor }} |
| 69 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + |
| 71 | + - name: Deploy web app container |
| 72 | + uses: azure/webapps-deploy@v2 |
| 73 | + with: |
| 74 | + app-name: ${{env.AZURE_WEBAPP_NAME}} |
| 75 | + images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}:${{ github.sha }} |
| 76 | + |
| 77 | + - name: Azure logout |
| 78 | + run: | |
| 79 | + az logout |
0 commit comments