container-publish.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # This Source Code Form is subject to the terms of the Mozilla Public
  2. # License, v. 2.0. If a copy of the MPL was not distributed with this
  3. # file, You can obtain one at https://mozilla.org/MPL/2.0/.
  4. on:
  5. workflow_dispatch:
  6. push:
  7. branches: [ main ]
  8. pull_request:
  9. branches: [ main ]
  10. env:
  11. REGISTRY: ghcr.io
  12. IMAGE_NAME: selkies-project/nvidia-glx-desktop
  13. jobs:
  14. build-2004:
  15. runs-on: ubuntu-latest
  16. permissions:
  17. contents: read
  18. packages: write
  19. steps:
  20. - name: Checkout repository
  21. uses: actions/checkout@v4
  22. - name: Fetch commit time
  23. run: echo "COMMIT_TIME_GIT=$(TZ=UTC git show -s --format='%cd' --date=format-local:'%Y%m%d%H%M%S')" >> $GITHUB_ENV
  24. - name: Log into registry ${{ env.REGISTRY }}
  25. if: github.event_name != 'pull_request'
  26. uses: docker/login-action@v2
  27. with:
  28. registry: ${{ env.REGISTRY }}
  29. username: ${{ github.actor }}
  30. password: ${{ secrets.GITHUB_TOKEN }}
  31. - name: Extract Container metadata
  32. id: meta
  33. uses: docker/metadata-action@v4
  34. with:
  35. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  36. - name: Build and push Ubuntu 20.04 Container image
  37. uses: docker/build-push-action@v4
  38. with:
  39. build-args: |
  40. UBUNTU_RELEASE=20.04
  41. context: .
  42. push: ${{ github.event_name != 'pull_request' }}
  43. tags: |
  44. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:20.04
  45. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:20.04-${{ env.COMMIT_TIME_GIT }}
  46. labels: ${{ steps.meta.outputs.labels }}
  47. build-2204:
  48. runs-on: ubuntu-latest
  49. permissions:
  50. contents: read
  51. packages: write
  52. steps:
  53. - name: Checkout repository
  54. uses: actions/checkout@v4
  55. - name: Fetch commit time
  56. run: echo "COMMIT_TIME_GIT=$(TZ=UTC git show -s --format='%cd' --date=format-local:'%Y%m%d%H%M%S')" >> $GITHUB_ENV
  57. - name: Log into registry ${{ env.REGISTRY }}
  58. if: github.event_name != 'pull_request'
  59. uses: docker/login-action@v2
  60. with:
  61. registry: ${{ env.REGISTRY }}
  62. username: ${{ github.actor }}
  63. password: ${{ secrets.GITHUB_TOKEN }}
  64. - name: Extract Container metadata
  65. id: meta
  66. uses: docker/metadata-action@v4
  67. with:
  68. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  69. - name: Build and push Ubuntu 22.04 Container image
  70. uses: docker/build-push-action@v4
  71. with:
  72. build-args: |
  73. UBUNTU_RELEASE=22.04
  74. context: .
  75. push: ${{ github.event_name != 'pull_request' }}
  76. tags: |
  77. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
  78. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:22.04
  79. ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:22.04-${{ env.COMMIT_TIME_GIT }}
  80. labels: ${{ steps.meta.outputs.labels }}