Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/workflows/update-test-ubuntu-git.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publishes the test-ubuntu-git Container Image
name: Publish test-ubuntu-git Container

on:
# Use an on demand workflow trigger.
Expand All @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
publish:
description: 'Publish to ghcr.io?'
description: 'Publish to ghcr.io? (main branch only)'
type: boolean
required: true
default: false
Expand Down Expand Up @@ -37,20 +37,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Use `docker/metadata-action` to preserve tags and labels that exist on the GHCR.io container image.
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/[email protected]
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Format Timestamp
id: timestamp
# Use `date` with a custom format to achieve the key=value format GITHUB_OUTPUT expects.
run: date -u "+now=%Y%m%d.%H%M%S.%3NZ" >> "$GITHUB_OUTPUT"

# Use `docker/build-push-action` to build (and optionally publish) the image.
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: images/test-ubuntu-git.Dockerfile
push: ${{ inputs.publish }}
tags: ${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA }}
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# For now, attempts to push to ghcr.io must target the `main` branch.
# In the future, consider also allowing attempts from `releases/*` branches.
push: ${{ inputs.publish && github.ref_name == 'main' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also pushes :latest right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I haven't included a :latest tag in this implementation.

There's only one known use case (test-proxy), so I'm OK to pinning that use case to an explicit timestamp.

tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}.${{ steps.timestamp.outputs.now }}