main.yml 2.0 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. strategy:
  16. matrix:
  17. python-version: [3.6, 3.7, 3.8, 3.9]
  18. steps:
  19. - uses: actions/checkout@master
  20. - name: Setup Python Matrix
  21. uses: actions/setup-python@v1
  22. with:
  23. python-version: ${{ matrix.python-version }}
  24. - name: Install dependencies
  25. run: |
  26. python -m pip install --upgrade pip
  27. - name: Lint with flake8
  28. run: |
  29. pip install flake8
  30. flake8 . --max-line-length=130
  31. buildx:
  32. runs-on: ubuntu-latest
  33. needs: test
  34. steps:
  35. -
  36. name: Checkout
  37. uses: actions/checkout@v2
  38. -
  39. name: Set up QEMU
  40. uses: docker/setup-qemu-action@v1
  41. -
  42. name: Set up Docker Buildx
  43. id: buildx
  44. uses: docker/setup-buildx-action@v1
  45. -
  46. name: Available platforms
  47. run: echo ${{ steps.buildx.outputs.platforms }}
  48. -
  49. name: Login to DockerHub
  50. uses: docker/login-action@v1
  51. with:
  52. username: ${{ secrets.DOCKERHUBUNAME }}
  53. password: ${{ secrets.DOCKERHUBTOKEN }}
  54. -
  55. name: Run Buildx
  56. run: |
  57. docker buildx build --push \
  58. --tag hvalev/dht22mqtt-homeassistant:latest \
  59. --tag hvalev/dht22mqtt-homeassistant:${BUILD_VERSION} \
  60. --tag ghcr.io/hvalev/dht22mqtt-homeassistant-docker:latest \
  61. --tag ghcr.io/hvalev/dht22mqtt-homeassistant-docker:${BUILD_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