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.

99 lines
3.0 KiB

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