container-publish.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. on:
  2. workflow_dispatch:
  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@v1
  22. with:
  23. registry: ${{ env.REGISTRY }}
  24. username: ${{ github.actor }}
  25. password: ${{ secrets.GITHUB_TOKEN }}
  26. - name: Extract Container metadata
  27. id: meta
  28. uses: docker/metadata-action@v3
  29. with:
  30. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  31. - name: Build and push Ubuntu 18.04 Container image
  32. uses: docker/build-push-action@v2
  33. with:
  34. build-args: |
  35. UBUNTU_RELEASE=18.04
  36. CUDA_VERSION=11.0.3
  37. context: .
  38. push: ${{ github.event_name != 'pull_request' }}
  39. tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:18.04
  40. labels: ${{ steps.meta.outputs.labels }}
  41. - name: Build and push Ubuntu 20.04 Container image
  42. uses: docker/build-push-action@v2
  43. with:
  44. build-args: |
  45. UBUNTU_RELEASE=20.04
  46. CUDA_VERSION=11.0.3
  47. context: .
  48. push: ${{ github.event_name != 'pull_request' }}
  49. tags: |
  50. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
  51. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:20.04
  52. labels: ${{ steps.meta.outputs.labels }}