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.

98 lines
2.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. name: basket-api
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - dev
  7. - feature/github-actions
  8. paths:
  9. - src/BuildingBlocks/*
  10. - src/Services/Basket/*
  11. - .github/workflows/basket-api.yml
  12. env:
  13. registryEndpoint:
  14. services: basket-api
  15. image: basket.api
  16. # branch: $(echo ${GITHUB_REF#refs/heads/})
  17. jobs:
  18. BuildContainersForPR_Linux:
  19. runs-on: ubuntu-16.04
  20. if: ${{ github.event_name == 'pull_request' }}
  21. steps:
  22. - name: Compose build ${{ env.services }}
  23. run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
  24. shell: bash
  25. env:
  26. TAG: ${{ env.branch }}
  27. REGISTRY: ${{ env.registryEndpoint }}
  28. BuildContainersForPR_Windows:
  29. runs-on: windows-2019
  30. if: ${{ false }}
  31. # if: ${{ github.event_name == 'pull_request' }}
  32. steps:
  33. - name: Compose build ${{ env.services }}
  34. run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
  35. shell: pwsh
  36. env:
  37. TAG: ${{ env.branch }}
  38. REGISTRY: ${{ env.registryEndpoint }}
  39. PLATFORM: win
  40. NODE_IMAGE: stefanscherer/node-windows:10
  41. BuildLinux:
  42. runs-on: ubuntu-latest
  43. if: ${{ github.event_name != 'pull_request' }}
  44. steps:
  45. - name: 'Checkout Github Action'
  46. uses: actions/checkout@master
  47. - name: Login to Container Registry
  48. uses: docker/login-action@v1
  49. with:
  50. registry: ${{ env.registryEndpoint }}
  51. username: ${{ secrets.USERNAME }}
  52. password: ${{ secrets.PASSWORD }}
  53. - name: Get branch name
  54. run: |
  55. currentbranch=$(echo ${GITHUB_REF##*/})
  56. echo "running on $currentbranch"
  57. echo "branch=$currentbranch" >> $GITHUB_ENV
  58. shell: bash
  59. - name: Compose build ${{ env.services }}
  60. run: |
  61. echo "Env variables:"
  62. echo "running on $env.branch"
  63. printenv
  64. sudo docker-compose -f src/docker-compose.yml build ${{ env.services }}
  65. docker images
  66. shell: bash
  67. env:
  68. TAG: ${{ env.branch }}
  69. REGISTRY: ${{ env.registryEndpoint }}
  70. - name: Compose push ${{ env.image }}
  71. run: sudo docker-compose -f src/docker-compose.yml push ${{ env.services }}
  72. shell: bash
  73. env:
  74. TAG: ${{ env.branch }}
  75. REGISTRY: ${{ env.registryEndpoint }}
  76. BuildWindows:
  77. runs-on: windows-2019
  78. if: ${{ false }}
  79. # if: ${{ github.event_name != 'pull_request' }}
  80. steps:
  81. - name: Compose build ${{ env.services }}
  82. run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
  83. shell: pwsh
  84. env:
  85. TAG: ${{ env.branch }}
  86. REGISTRY: ${{ env.registryEndpoint }}
  87. - name: Compose push ${{ env.image }}
  88. run: docker-compose push -f src/docker-compose.yml ${{ env.services }}'
  89. shell: pwsh
  90. env:
  91. TAG: ${{ env.branch }}
  92. REGISTRY: ${{ env.registryEndpoint }}