docker_build_pre.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Docker Image CI Pre
  2. on:
  3. workflow_dispatch:
  4. release:
  5. types: [ prereleased ]
  6. env:
  7. REGISTRY: ghcr.io
  8. jobs:
  9. build-and-push-image:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. contents: read
  13. packages: write
  14. steps:
  15. - name: Get version
  16. id: get_version
  17. run: |
  18. echo "VERSION=pre${GITHUB_REF/refs\/tags\//}" >> ${GITHUB_ENV}
  19. echo "${GITHUB_REF/refs\/tags\//}"
  20. echo "${GITHUB_REF#refs/*/}"
  21. echo "${GITHUB_REF}"
  22. - uses: actions/checkout@v3
  23. - name: set lower case repository name
  24. run: |
  25. echo "REPOSITORY_LC=${REPOSITORY,,}" >> ${GITHUB_ENV}
  26. env:
  27. REPOSITORY: '${{ github.repository }}'
  28. - name: Set up QEMU
  29. uses: docker/setup-qemu-action@v3
  30. - name: Set up Docker Buildx
  31. uses: docker/setup-buildx-action@v3
  32. - name: Log in to the Container registry
  33. uses: docker/login-action@v2.1.0
  34. with:
  35. registry: ${{ env.REGISTRY }}
  36. username: ${{ github.actor }}
  37. password: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Build and push Docker images
  39. uses: docker/build-push-action@v4
  40. with:
  41. context: .
  42. platforms: |
  43. linux/386
  44. linux/amd64
  45. linux/arm/v7
  46. linux/arm64
  47. linux/mips64le
  48. linux/ppc64le
  49. push: true
  50. tags: |
  51. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}