You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.6 KiB

  1. name: webshoppingagg
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - dev
  7. paths:
  8. - src/ApiGateways/Web.Bff.Shopping/aggregator/*
  9. - .github/workflows/webshoppingagg.yml
  10. pull_request:
  11. branches:
  12. - main
  13. - dev
  14. env:
  15. SERVICE: webshoppingagg
  16. IMAGE: webshoppingagg
  17. jobs:
  18. BuildContainersForPR_Linux:
  19. runs-on: ubuntu-latest
  20. if: ${{ github.event_name == 'pull_request' }}
  21. steps:
  22. - name: 'Checkout Github Action'
  23. uses: actions/checkout@master
  24. - name: Compose build ${{ env.SERVICE }}
  25. run: sudo -E docker-compose build ${{ env.SERVICE }}
  26. working-directory: ./src
  27. shell: bash
  28. env:
  29. TAG: ${{ env.BRANCH }}
  30. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  31. BuildLinux:
  32. runs-on: ubuntu-latest
  33. if: ${{ github.event_name != 'pull_request' }}
  34. steps:
  35. - name: 'Checkout Github Action'
  36. uses: actions/checkout@master
  37. - name: Enable experimental features for the Docker daemon and CLI
  38. run: |
  39. echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
  40. mkdir -p ~/.docker
  41. echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
  42. sudo service docker restart
  43. docker version -f '{{.Client.Experimental}}'
  44. docker version -f '{{.Server.Experimental}}'
  45. - name: Login to Container Registry
  46. uses: docker/login-action@v1
  47. with:
  48. registry: ${{ secrets.REGISTRY_HOST }}
  49. username: ${{ secrets.USERNAME }}
  50. password: ${{ secrets.PASSWORD }}
  51. - name: Set branch name as env variable
  52. run: |
  53. currentbranch=$(echo ${GITHUB_REF##*/})
  54. echo "running on $currentbranch"
  55. echo "BRANCH=$currentbranch" >> $GITHUB_ENV
  56. shell: bash
  57. - name: Compose build ${{ env.SERVICE }}
  58. run: sudo -E docker-compose build ${{ env.SERVICE }}
  59. working-directory: ./src
  60. shell: bash
  61. env:
  62. TAG: ${{ env.BRANCH }}
  63. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  64. - name: Compose push ${{ env.SERVICE }}
  65. run: sudo -E docker-compose push ${{ env.SERVICE }}
  66. working-directory: ./src
  67. shell: bash
  68. env:
  69. TAG: ${{ env.BRANCH }}
  70. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  71. - name: Create multiarch manifest
  72. run: |
  73. docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
  74. docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
  75. shell: bash