main.yml 1.9 KB

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