main.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: build
  2. on:
  3. push:
  4. tags:
  5. - 'v*'
  6. paths-ignore:
  7. - 'README.md'
  8. - datasets/**
  9. jobs:
  10. test:
  11. name: Lint test
  12. runs-on: ubuntu-18.04
  13. steps:
  14. - uses: actions/checkout@master
  15. - name: Setup Python
  16. uses: actions/setup-python@v2.2.2
  17. with:
  18. python-version: 3.7
  19. - name: Install dependencies
  20. run: |
  21. python -m pip install --upgrade pip
  22. - name: Lint with flake8
  23. run: |
  24. pip install flake8
  25. flake8 . --max-line-length=130
  26. buildx:
  27. runs-on: ubuntu-18.04
  28. needs: test
  29. steps:
  30. -
  31. name: Checkout
  32. uses: actions/checkout@v2
  33. -
  34. name: Get Version
  35. id: get_version
  36. uses: battila7/get-version-action@v2.2.1
  37. -
  38. name: Set up QEMU
  39. uses: docker/setup-qemu-action@v1
  40. -
  41. name: Set up Docker Buildx
  42. id: buildx
  43. uses: docker/setup-buildx-action@v1
  44. -
  45. name: Available platforms
  46. run: echo ${{ steps.buildx.outputs.platforms }}
  47. -
  48. name: Login to DockerHub
  49. uses: docker/login-action@v1
  50. with:
  51. username: ${{ secrets.DOCKERHUBUNAME }}
  52. password: ${{ secrets.DOCKERHUBTOKEN }}
  53. -
  54. name: Run Buildx
  55. run: |
  56. docker buildx build --push \
  57. --tag hvalev/dht22mqtt-homeassistant:latest \
  58. --tag hvalev/dht22mqtt-homeassistant:${{ steps.get_version.outputs.version-without-v }} \
  59. --platform linux/arm/v7,linux/arm64 .
  60. -
  61. name: Docker Hub Description
  62. uses: peter-evans/dockerhub-description@v2
  63. env:
  64. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUBUNAME }}
  65. DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUBPWD }}
  66. DOCKERHUB_REPOSITORY: hvalev/dht22mqtt-homeassistant