mirror of
https://github.com/actions/checkout.git
synced 2024-12-23 00:06:31 +08:00
Refine workflow for generating test-ubuntu-git
(#1617)
This commit is contained in:
parent
473055ba18
commit
df0bcddf6d
23
.github/workflows/update-test-ubuntu-git.yml
vendored
23
.github/workflows/update-test-ubuntu-git.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Publishes the test-ubuntu-git Container Image
|
name: Publish test-ubuntu-git Container
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Use an on demand workflow trigger.
|
# Use an on demand workflow trigger.
|
||||||
|
@ -7,7 +7,7 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
publish:
|
publish:
|
||||||
description: 'Publish to ghcr.io?'
|
description: 'Publish to ghcr.io? (main branch only)'
|
||||||
type: boolean
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
default: false
|
default: false
|
||||||
|
@ -37,12 +37,10 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Use `docker/metadata-action` to preserve tags and labels that exist on the GHCR.io container image.
|
- name: Format Timestamp
|
||||||
# - name: Extract metadata (tags, labels) for Docker
|
id: timestamp
|
||||||
# id: meta
|
# Use `date` with a custom format to achieve the key=value format GITHUB_OUTPUT expects.
|
||||||
# uses: docker/metadata-action@v5.5.1
|
run: date -u "+now=%Y%m%d.%H%M%S.%3NZ" >> "$GITHUB_OUTPUT"
|
||||||
# with:
|
|
||||||
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
|
|
||||||
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
@ -50,7 +48,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: images/test-ubuntu-git.Dockerfile
|
file: images/test-ubuntu-git.Dockerfile
|
||||||
push: ${{ inputs.publish }}
|
# For now, attempts to push to ghcr.io must target the `main` branch.
|
||||||
tags: ${{ env.IMAGE_NAME }}:sha-${{ env.GITHUB_SHA }}
|
# In the future, consider also allowing attempts from `releases/*` branches.
|
||||||
# tags: ${{ steps.meta.outputs.tags }}
|
push: ${{ inputs.publish && github.ref_name == 'main' }}
|
||||||
# labels: ${{ steps.meta.outputs.labels }}
|
tags: |
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}.${{ steps.timestamp.outputs.now }}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user