docker_build_pre.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: Log in to the Container registry
  29. uses: docker/login-action@v2.1.0
  30. with:
  31. registry: ${{ env.REGISTRY }}
  32. username: ${{ github.actor }}
  33. password: ${{ secrets.GITHUB_TOKEN }}
  34. - name: Build and push Docker images
  35. uses: docker/build-push-action@v4
  36. with:
  37. context: .
  38. push: true
  39. tags: |
  40. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ env.VERSION }}