release.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: Docker Image CI
  2. on:
  3. push:
  4. tags:
  5. - "*"
  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: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
  18. - uses: actions/checkout@v3
  19. - name: set lower case repository name
  20. run: |
  21. echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
  22. env:
  23. REPOSITORY: '${{ github.repository }}'
  24. - name: Log in to the Container registry
  25. uses: docker/login-action@v2.1.0
  26. with:
  27. registry: ${{ env.REGISTRY }}
  28. username: ${{ github.actor }}
  29. password: ${{ secrets.GITHUB_TOKEN }}
  30. - name: Build and push Docker images
  31. uses: docker/build-push-action@v4
  32. with:
  33. context: .
  34. push: true
  35. tags: |
  36. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:${{ steps.get_version.outputs.VERSION }}
  37. ${{ env.REGISTRY }}/${{ env.REPOSITORY_LC }}:latest