main.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: build
  2. on:
  3. push:
  4. branches:
  5. - 'master'
  6. jobs:
  7. docker:
  8. runs-on: ubuntu-latest
  9. strategy:
  10. matrix:
  11. alpine: [ "3.13" ]
  12. variant: [ "", "openrc" ]
  13. latest: [ false ]
  14. include:
  15. - alpine: 3.16
  16. variant: ""
  17. latest: true
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v2
  21. - name: Docker metadata
  22. id: meta
  23. uses: docker/metadata-action@v4
  24. with:
  25. images: |
  26. dockage/alpine
  27. tags: |
  28. type=raw,value=${{ matrix.alpine }},enable=${{ matrix.variant == '' }}
  29. type=raw,value=${{ matrix.alpine }}-${{ matrix.variant }},enable=${{ matrix.variant != '' }}
  30. type=raw,value=latest,enable=${{ matrix.variant }}
  31. - name: Set up Docker Buildx
  32. uses: docker/setup-buildx-action@v2
  33. - name: Login to DockerHub
  34. if: ${{ github.event_name != 'pull_request' }}
  35. uses: docker/login-action@v2
  36. with:
  37. username: ${{ secrets.DOCKERHUB_USERNAME }}
  38. password: ${{ secrets.DOCKERHUB_PASSWORD }}
  39. - name: Build images
  40. uses: docker/bake-action@v2
  41. with:
  42. push: ${{ is_default_branch }}
  43. targets: ${{ matrix.variant }}
  44. files: |
  45. ${{ steps.meta.outputs.bake-file }}
  46. ./docker-bake.hcl
  47. env:
  48. ALPINE_VERSION: ${{ matrix.alpine }}
  49. - name: Docker Hub Description
  50. uses: peter-evans/dockerhub-description@v3
  51. if: ${{ github.event_name == 'push' && is_default_branch }}
  52. with:
  53. username: ${{ secrets.DOCKERHUB_USERNAME }}
  54. password: ${{ secrets.DOCKERHUB_PASSWORD }}
  55. short-description: ${{ github.event.repository.description }}