Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test already exist #55

Merged
merged 6 commits into from
Apr 3, 2023
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
27 changes: 18 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
description: Tag name of Docker image
default: 'latest'

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}

jobs:
build-deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,14 +43,20 @@ jobs:
date -u +"build_date=%Y-%m-%dT%H:%M:%SZ" >> $GITHUB_ENV
echo "vcs_ref=`git rev-parse --short HEAD`" >> $GITHUB_ENV

- name: Build the OCR-D Manager image (ghcr.io/slub/ocrd_manager:${{ github.event.inputs.image-tag }}) and deploy to GitHub Container Repository
- name: Determine vcs_ref lable of current image (${{ env.IMAGE_NAME }}:${{ github.event.inputs.image-tag }})
run: |
docker pull ${{ env.IMAGE_NAME }}:${{ github.event.inputs.image-tag }}
echo current_vcs_ref=`docker inspect ${{ env.IMAGE_NAME }}:${{ github.event.inputs.image-tag }} | jq '.[0].Config.Labels | ."org.label-schema.vcs-ref"'` >> $GITHUB_ENV

- name: Build the OCR-D Manager image (${{ env.IMAGE_NAME }}:${{ github.event.inputs.image-tag }}) and deploy to GitHub Container Repository
if: env.vcs_ref == env.current_vcs_ref
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ghcr.io/slub/ocrd_manager:${{ github.event.inputs.image-tag }}
build-args: |
BUILD_DATE=${{ env.build_date }}
VCS_REF=${{ env.vcs_ref }}
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:${{ github.event.inputs.image-tag }}
build-args: |
BUILD_DATE=${{ env.build_date }}
VCS_REF=${{ env.vcs_ref }}
cache-from: type=gha
cache-to: type=gha,mode=max