docker.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ---
  2. name: Docker
  3. on:
  4. push:
  5. branches:
  6. - master
  7. paths:
  8. - '.github/workflows/docker.yml'
  9. - 'netdata-installer.sh'
  10. - 'packaging/**'
  11. pull_request:
  12. paths:
  13. - '.github/workflows/docker.yml'
  14. - 'netdata-installer.sh'
  15. - 'packaging/**'
  16. workflow_dispatch:
  17. inputs:
  18. version:
  19. name: Version Tag
  20. default: nightly
  21. required: true
  22. jobs:
  23. docker-build:
  24. name: Docker Build
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v2
  29. - name: Determine if we should push changes and which tags to use
  30. if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly'
  31. run: |
  32. echo "publish=true" >> $GITHUB_ENV
  33. echo "tags=netdata/netdata:latest,netdata/netdata:stable,netdata/netdata:${{ github.event.inputs.version }}" >> $GITHUB_ENV
  34. - name: Determine if we should push changes and which tags to use
  35. if: github.event_name == 'workflow_dispatch' && github.event.inputs.version == 'nightly'
  36. run: |
  37. echo "publish=true" >> $GITHUB_ENV
  38. echo "tags=netdata/netdata:latest,netdata/netdata:edge" >> $GITHUB_ENV
  39. - name: Determine if we should push changes and which tags to use
  40. if: github.event_name != 'workflow_dispatch'
  41. run: |
  42. echo "publish=false" >> $GITHUB_ENV
  43. echo "tags=netdata/netdata:test" >> $GITHUB_ENV
  44. - name: Setup QEMU
  45. uses: docker/setup-qemu-action@v1
  46. - name: Setup Buildx
  47. uses: docker/setup-buildx-action@v1
  48. - name: Docker Hub Login
  49. if: github.event_name == 'workflow_dispatch'
  50. uses: docker/login-action@v1
  51. with:
  52. username: ${{ secrets.DOCKER_HUB_USERNAME }}
  53. password: ${{ secrets.DOCKER_HUB_PASSWORD }}
  54. - name: Docker Build
  55. uses: docker/build-push-action@v2
  56. with:
  57. platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64
  58. push: ${{ env.publish }}
  59. tags: ${{ env.tags }}