mirror of
https://github.com/allenai/olmocr.git
synced 2025-06-27 04:00:02 +00:00
docker fixed version tag for dev run
This commit is contained in:
parent
21e5ab5dd0
commit
90342efc7e
41
.github/workflows/docker-build.yml
vendored
41
.github/workflows/docker-build.yml
vendored
@ -7,6 +7,11 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
- '*.*.*'
|
- '*.*.*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Version (e.g., 1.0.0) - leave empty for dev build'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.io
|
REGISTRY: docker.io
|
||||||
@ -43,6 +48,26 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Calculate version tags
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] && [[ -n "${{ github.event.inputs.version }}" ]]; then
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
VERSION="${VERSION#v}" # Remove v prefix if present
|
||||||
|
|
||||||
|
# Split version into parts
|
||||||
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
||||||
|
|
||||||
|
# Generate tags
|
||||||
|
echo "tags<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${MAJOR}.${MINOR}" >> $GITHUB_OUTPUT
|
||||||
|
echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${MAJOR}" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Extract metadata
|
- name: Extract metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@ -54,14 +79,24 @@ jobs:
|
|||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
type=raw,value={{date 'YYYYMMDD-HHmmss'}}-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' }}
|
type=raw,value=dev-{{date 'YYYYMMDD'}}-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version == '' }}
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
|
|
||||||
|
- name: Override tags for manual version
|
||||||
|
id: tags
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] && [[ -n "${{ github.event.inputs.version }}" ]]; then
|
||||||
|
echo "tags=${{ steps.version.outputs.tags }}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "tags=${{ steps.meta.outputs.tags }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Debug metadata
|
- name: Debug metadata
|
||||||
run: |
|
run: |
|
||||||
echo "Tags: ${{ steps.meta.outputs.tags }}"
|
echo "Final Tags: ${{ steps.tags.outputs.tags }}"
|
||||||
echo "Labels: ${{ steps.meta.outputs.labels }}"
|
echo "Labels: ${{ steps.meta.outputs.labels }}"
|
||||||
|
echo "Version: ${{ steps.version.outputs.version || steps.meta.outputs.version }}"
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
@ -69,7 +104,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.tags.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
outputs: type=registry
|
outputs: type=registry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user