update-test-ubuntu-git.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: Publishes the test-ubuntu-git Container Image
  2. on:
  3. # Use an on demand workflow trigger.
  4. # (Forked copies of actions/checkout won't have permission to update GHCR.io/actions,
  5. # so avoid trigger events that run automatically.)
  6. workflow_dispatch:
  7. inputs:
  8. publish:
  9. description: 'Publish to ghcr.io?'
  10. type: boolean
  11. required: true
  12. default: false
  13. env:
  14. REGISTRY: ghcr.io
  15. IMAGE_NAME: actions/test-ubuntu-git
  16. jobs:
  17. build-and-push-image:
  18. runs-on: ubuntu-latest
  19. # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
  20. permissions:
  21. contents: read
  22. packages: write
  23. steps:
  24. - name: Checkout repository
  25. uses: actions/checkout@v4
  26. # Use `docker/login-action` to log in to GHCR.io.
  27. # Once published, the packages are scoped to the account defined here.
  28. - name: Log in to the ghcr.io container registry
  29. uses: docker/login-action@v3.0.0
  30. with:
  31. registry: ${{ env.REGISTRY }}
  32. username: ${{ github.actor }}
  33. password: ${{ secrets.GITHUB_TOKEN }}
  34. # Use `docker/metadata-action` to preserve tags and labels that exist on the GHCR.io container image.
  35. # - name: Extract metadata (tags, labels) for Docker
  36. # id: meta
  37. # uses: docker/metadata-action@v5.5.1
  38. # with:
  39. # images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  40. # Use `docker/build-push-action` to build (and optionally publish) the image.
  41. - name: Build and push Docker image
  42. uses: docker/build-push-action@v5.1.0
  43. with:
  44. context: .
  45. file: images/test-ubuntu-git.Dockerfile
  46. push: ${{ inputs.publish }}
  47. tags: ${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA }}
  48. # tags: ${{ steps.meta.outputs.tags }}
  49. # labels: ${{ steps.meta.outputs.labels }}