docker-image.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: docker hub release
  2. # build master with multi-arch to docker hub
  3. on:
  4. push:
  5. # Sequence of patterns matched against refs/tags
  6. tags:
  7. - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
  8. jobs:
  9. buildx-dockerhub:
  10. runs-on: ubuntu-latest
  11. env:
  12. DOCKER_REPO: jeessy/backup-x
  13. DOCKER_PLATFORMS: linux/amd64,linux/arm64
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v4
  17. - name: Set up QEMU
  18. uses: docker/setup-qemu-action@v3
  19. - name: Set up Docker buildx
  20. uses: docker/setup-buildx-action@v3
  21. - name: Prepare arguments
  22. run: |
  23. echo "VERSION=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
  24. - name: Docker login # login to docker hub, automatically logout at the end of job
  25. uses: docker/login-action@v2
  26. with:
  27. username: ${{ secrets.DOCKER_USERNAME }}
  28. password: ${{ secrets.DOCKER_PASSWORD }}
  29. - name: Run buildx and push
  30. uses: docker/build-push-action@v3
  31. with:
  32. context: .
  33. push: true # push to docker hub
  34. platforms: ${{ env.DOCKER_PLATFORMS }}
  35. tags: |
  36. ${{ env.DOCKER_REPO }}:latest
  37. ${{ env.DOCKER_REPO }}:${{ env.VERSION }}