main.yml 2.0 KB

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