container-publish.yml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. context: .
  37. push: ${{ github.event_name != 'pull_request' }}
  38. tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:18.04
  39. labels: ${{ steps.meta.outputs.labels }}
  40. - name: Build and push Ubuntu 20.04 Container image
  41. uses: docker/build-push-action@v2
  42. with:
  43. build-args: |
  44. UBUNTU_RELEASE=20.04
  45. context: .
  46. push: ${{ github.event_name != 'pull_request' }}
  47. tags: |
  48. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
  49. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:20.04
  50. labels: ${{ steps.meta.outputs.labels }}