release-docker.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Manual Docker release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. tag:
  6. name: tag name
  7. required: true
  8. default: latest
  9. description: Tag under which the images should be published.
  10. is-latest:
  11. name: "is latest?"
  12. required: true
  13. default: false
  14. description: Whether the build is also the latest version.
  15. jobs:
  16. docker:
  17. name: Docker release
  18. runs-on: ubuntu-18.04
  19. strategy:
  20. fail-fast: false
  21. matrix:
  22. distro:
  23. - ubuntu
  24. - alpine
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@v2
  28. - name: Create Docker image
  29. run: |
  30. docker build \
  31. --tag pandocscholar/${{ matrix.distro }}:latest \
  32. --file docker/${{ matrix.distro }}.Dockerfile \
  33. .
  34. - name: Run Docker on example
  35. run: |
  36. docker run --rm \
  37. --user "$(id -u):$(id -g)" \
  38. --volume "$(pwd)/example:/data" \
  39. pandocscholar/${{ matrix.distro }}:latest
  40. - name: Login to Docker Hub
  41. run: >-
  42. echo "${{ secrets.DOCKER_HUB_TOKEN }}" |
  43. docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
  44. - name: Push image as latest
  45. if: github.event.inputs.is-latest != false
  46. run: docker push pandocscholar/${{ matrix.distro }}:latest
  47. - name: Push image as tag
  48. run: |
  49. docker tag \
  50. pandocscholar/${{ matrix.distro }}:latest \
  51. pandocscholar/${{ matrix.distro }}:${{ github.event.inputs.tag }}
  52. docker push pandocscholar/${{ matrix.distro }}:${{ github.event.inputs.tag }}