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.

86 lines
3.1 KiB

  1. name: "DINAR: Docker Image Building"
  2. on:
  3. push:
  4. paths:
  5. - ".DINAR/**"
  6. - ".github/workflows/DINAR.yml"
  7. schedule:
  8. - cron: "5 5 * * 0"
  9. jobs:
  10. rebuild-images:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout Repo
  14. uses: actions/checkout@v2
  15. with:
  16. path: REPO
  17. - name: Checkout DINAR
  18. uses: actions/checkout@v2
  19. with:
  20. path: DINAR
  21. repository: itpp-labs/DINAR
  22. ref: master
  23. - uses: actions/setup-python@v1
  24. with:
  25. python-version: "3.7.x"
  26. - name: Prepare build folder
  27. run: |
  28. cp -rnT DINAR/embedded-files/ REPO/
  29. - name: Set vars
  30. run: |
  31. REF="${{ github.ref }}"
  32. BRANCH=${REF##*/}
  33. REPOSITORY="${{ github.repository }}"
  34. REPO_NAME=${REPOSITORY##*/}
  35. IMAGE_CODE=$REPO_NAME:$BRANCH
  36. ODOO_VERSION="$(echo $BRANCH | python DINAR/workflow-files/branch2odoo_version.py)"
  37. echo "ODOO_VERSION=$ODOO_VERSION"
  38. echo "::set-env name=ODOO_VERSION::$ODOO_VERSION"
  39. echo "::set-env name=IMAGE_ODOO_BASE::${{ github.repository }}/dinar-deps-$IMAGE_CODE"
  40. echo "::set-env name=IMAGE_CODE::$IMAGE_CODE"
  41. # Registry credentials. External registry potentially can be customized here
  42. echo "::set-env name=REGISTRY::docker.pkg.github.com"
  43. echo "::set-env name=REGISTRY_USERNAME::${{ github.actor }}"
  44. echo "::set-env name=REGISTRY_PASSWORD::${{ secrets.DINAR_TOKEN }}"
  45. - name: Handle Dependencies
  46. uses: elgohr/Publish-Docker-Github-Action@master
  47. env:
  48. LOCAL_CUSTOM_DIR: ./image
  49. AGGREGATE: true
  50. PIP_INSTALL_ODOO: false
  51. CLEAN: false
  52. COMPILE: false
  53. with:
  54. name: ${{ env.IMAGE_ODOO_BASE }}
  55. registry: ${{ env.REGISTRY }}
  56. username: ${{ env.REGISTRY_USERNAME }}
  57. password: ${{ env.REGISTRY_PASSWORD }}
  58. buildargs: ODOO_VERSION,AGGREGATE,PIP_INSTALL_ODOO,CLEAN,COMPILE,LOCAL_CUSTOM_DIR
  59. workdir: REPO/.DINAR/
  60. cache: ${{ github.event_name != 'schedule' }}
  61. - name: Install shyaml
  62. run: |
  63. pip install shyaml
  64. - name: Install Base Addons
  65. run: |
  66. # authenticate
  67. echo "$REGISTRY_PASSWORD" | docker login -u "$REGISTRY_USERNAME" --password-stdin "$REGISTRY"
  68. # convert "base-addons" list to comma-separated list
  69. export MODULES=$(cat REPO/.DINAR/volumes/addons.yaml | shyaml get-values base-addons | xargs | sed "s/ /,/g")
  70. export DB_VERSION=10
  71. export REPOSITORY=${{ github.repository }}
  72. export DOODBA_WITHOUT_DEMO=all
  73. export IMAGE_DB=${{ github.repository }}/dinar-db-nodemo-$IMAGE_CODE
  74. export IMAGE_ODOO=${{ github.repository }}/dinar-odoo-nodemo-$IMAGE_CODE
  75. bash DINAR/workflow-files/images-with-preinstalled-modules.sh
  76. export DOODBA_WITHOUT_DEMO=false
  77. export IMAGE_DB=${{ github.repository }}/dinar-db-$IMAGE_CODE
  78. export IMAGE_ODOO=${{ github.repository }}/dinar-odoo-$IMAGE_CODE
  79. bash DINAR/workflow-files/images-with-preinstalled-modules.sh