docker-publish.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. name: Docker
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. env:
  8. REGISTRY: ghcr.io
  9. IMAGE_NAME: ehfd/nvidia-glx-desktop
  10. jobs:
  11. build:
  12. runs-on: ubuntu-latest
  13. permissions:
  14. contents: read
  15. packages: write
  16. steps:
  17. - name: Checkout repository
  18. uses: actions/checkout@v2
  19. - name: Log into registry ${{ env.REGISTRY }}
  20. if: github.event_name != 'pull_request'
  21. uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
  22. with:
  23. registry: ${{ env.REGISTRY }}
  24. username: ${{ github.actor }}
  25. password: ${{ secrets.GITHUB_TOKEN }}
  26. - name: Extract Docker metadata
  27. id: meta
  28. uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
  29. with:
  30. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  31. - name: Build and push Docker image
  32. uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
  33. with:
  34. context: .
  35. push: ${{ github.event_name != 'pull_request' }}
  36. tags: latest
  37. labels: ${{ steps.meta.outputs.labels }}