You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

90 lines
2.8 KiB

  1. name: Deploy multi-architecture Docker images for transfer.sh with buildx
  2. on:
  3. schedule:
  4. - cron: '0 0 * * *' # everyday at midnight UTC
  5. pull_request:
  6. branches: master
  7. push:
  8. branches: master
  9. tags:
  10. - v*
  11. jobs:
  12. buildx:
  13. runs-on: ubuntu-latest
  14. steps:
  15. -
  16. name: Checkout
  17. uses: actions/checkout@v2
  18. -
  19. name: Prepare
  20. id: prepare
  21. run: |
  22. DOCKER_IMAGE=dutchcoders/transfer.sh
  23. DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64,linux/386
  24. VERSION=edge
  25. if [[ $GITHUB_REF == refs/tags/* ]]; then
  26. VERSION=${GITHUB_REF#refs/tags/v}
  27. fi
  28. if [ "${{ github.event_name }}" = "schedule" ]; then
  29. VERSION=nightly
  30. fi
  31. TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
  32. if [ $VERSION = edge -o $VERSION = nightly ]; then
  33. TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
  34. fi
  35. echo ::set-output name=docker_image::${DOCKER_IMAGE}
  36. echo ::set-output name=version::${VERSION}
  37. echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
  38. --build-arg VERSION=${VERSION} \
  39. --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
  40. --build-arg VCS_REF=${GITHUB_SHA::8} \
  41. ${TAGS} .
  42. -
  43. name: Set up QEMU
  44. uses: docker/setup-qemu-action@v1
  45. with:
  46. platforms: all
  47. -
  48. name: Set up Docker Buildx
  49. id: buildx
  50. uses: docker/setup-buildx-action@v1
  51. with:
  52. version: latest
  53. -
  54. name: Available platforms
  55. run: echo ${{ steps.buildx.outputs.platforms }}
  56. -
  57. name: Docker Buildx (build)
  58. run: |
  59. docker buildx build --no-cache --pull --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
  60. -
  61. name: Docker Login
  62. if: success() && github.event_name != 'pull_request'
  63. env:
  64. DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
  65. DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
  66. run: |
  67. echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
  68. -
  69. name: Docker Buildx (push)
  70. if: success() && github.event_name != 'pull_request'
  71. run: |
  72. docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
  73. -
  74. name: Docker Check Manifest
  75. if: always() && github.event_name != 'pull_request'
  76. run: |
  77. docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
  78. -
  79. name: Clear
  80. if: always() && github.event_name != 'pull_request'
  81. run: |
  82. rm -f ${HOME}/.docker/config.json