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.

101 lines
3.0 KiB

  1. name: payment-api
  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/BuildingBlocks/**
  18. - src/Services/Payment/**
  19. - .github/workflows/payment-api.yml
  20. pull_request:
  21. branches:
  22. - dev
  23. paths:
  24. - src/BuildingBlocks/**
  25. - src/Services/Payment/**
  26. - .github/workflows/payment-api.yml
  27. env:
  28. SERVICE: payment-api
  29. IMAGE: payment.api
  30. jobs:
  31. BuildContainersForPR_Linux:
  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: Compose build ${{ env.SERVICE }}
  38. run: sudo -E docker-compose build ${{ env.SERVICE }}
  39. working-directory: ./src
  40. shell: bash
  41. env:
  42. TAG: ${{ env.BRANCH }}
  43. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  44. BuildLinux:
  45. runs-on: ubuntu-latest
  46. if: ${{ github.event_name != 'pull_request' }}
  47. steps:
  48. - name: 'Checkout Github Action'
  49. uses: actions/checkout@master
  50. - name: Enable experimental features for the Docker daemon and CLI
  51. run: |
  52. echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
  53. mkdir -p ~/.docker
  54. echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
  55. sudo service docker restart
  56. docker version -f '{{.Client.Experimental}}'
  57. docker version -f '{{.Server.Experimental}}'
  58. - name: Login to Container Registry
  59. uses: docker/login-action@v1
  60. with:
  61. registry: ${{ secrets.REGISTRY_HOST }}
  62. username: ${{ secrets.USERNAME }}
  63. password: ${{ secrets.PASSWORD }}
  64. - name: Set branch name as env variable
  65. run: |
  66. currentbranch=$(echo ${GITHUB_REF##*/})
  67. echo "running on $currentbranch"
  68. echo "BRANCH=$currentbranch" >> $GITHUB_ENV
  69. shell: bash
  70. - name: Compose build ${{ env.SERVICE }}
  71. run: sudo -E docker-compose build ${{ env.SERVICE }}
  72. working-directory: ./src
  73. shell: bash
  74. env:
  75. TAG: ${{ env.BRANCH }}
  76. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  77. - name: Compose push ${{ env.SERVICE }}
  78. run: sudo -E docker-compose push ${{ env.SERVICE }}
  79. working-directory: ./src
  80. shell: bash
  81. env:
  82. TAG: ${{ env.BRANCH }}
  83. REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
  84. - name: Create multiarch manifest
  85. run: |
  86. docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }}
  87. docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }}
  88. shell: bash