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.

100 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
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: borjasanes/eshoponcontainers
  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:
  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. echo "TAG=$currentbranch" >> $GITHUB_ENV
  59. shell: bash
  60. - name: Compose build ${{ env.services }}
  61. run: |
  62. sudo -E docker-compose build ${{ env.services }}
  63. docker images
  64. working-directory: ./src
  65. shell: bash
  66. env:
  67. # TAG: ${{ env.branch }}
  68. REGISTRY: ${{ env.registryEndpoint }}
  69. - name: Compose push ${{ env.image }}
  70. run: |
  71. docker images
  72. sudo -E docker-compose push ${{ env.services }}
  73. working-directory: ./src
  74. shell: bash
  75. env:
  76. # TAG: ${{ env.branch }}
  77. REGISTRY: ${{ env.registryEndpoint }}
  78. BuildWindows:
  79. runs-on: windows-2019
  80. if: ${{ false }}
  81. # if: ${{ github.event_name != 'pull_request' }}
  82. steps:
  83. - name: Compose build ${{ env.services }}
  84. run: docker-compose build -f src/docker-compose.yml ${{ env.services }}
  85. shell: pwsh
  86. env:
  87. TAG: ${{ env.branch }}
  88. REGISTRY: ${{ env.registryEndpoint }}
  89. - name: Compose push ${{ env.image }}
  90. run: docker-compose push -f src/docker-compose.yml ${{ env.services }}'
  91. shell: pwsh
  92. env:
  93. TAG: ${{ env.branch }}
  94. REGISTRY: ${{ env.registryEndpoint }}