Update README.md #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Kitodo.Production for OCR-D | |
on: | |
push: | |
branches: | |
- main | |
- stable | |
workflow_dispatch: # run manually | |
env: | |
IMAGE_TAG: latest | |
GIT_OWNER: markusweigelt | |
GIT_REPO: kitodo-production | |
GIT_REF: ocrd-main | |
REGISTRY_PATH: ghcr.io/slub/ocrd_kitodo | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set environment variables for the stable version | |
if: endsWith(github.ref, '/stable') | |
run: | | |
echo "GIT_REF=2fe8c87bf340aa41ea11f76605bc89c2baff04cc" >> $GITHUB_ENV # stable ref | |
echo "IMAGE_TAG=stable" >> $GITHUB_ENV | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Checkout Kitodo.Production Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.GIT_OWNER }}/${{ env.GIT_REPO }} | |
ref: ${{ env.GIT_REF }} | |
path: _tmp/kitodo-production | |
- # Activate cache export feature to reduce build time of images | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine build args | |
run: | | |
date -u +"build_date=%Y-%m-%dT%H:%M:%SZ" >> $GITHUB_ENV | |
echo "vcs_ref=`git -C ./_tmp/kitodo-production rev-parse --short HEAD`" >> $GITHUB_ENV | |
- name: Build the OCR-D Kitodo.Production image from module and deploy to GitHub Container Repository | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./_modules/kitodo-production-docker | |
push: true | |
tags: ${{ env.REGISTRY_PATH }}/kitodo_production_ocrd:${{ env.IMAGE_TAG }} | |
build-args: | | |
BUILD_DATE=${{ env.build_date }} | |
VCS_REF=${{ env.vcs_ref }} | |
VCS_URL=https://github.com/${{ env.GIT_OWNER }}/${{ env.GIT_REPO }}/tree/${{ env.GIT_REF }}/ | |
BUILDER_TYPE=git | |
BUILDER_GIT_COMMIT=${{ env.GIT_REF }} | |
BUILDER_GIT_SOURCE_URL=https://github.com/${{ env.GIT_OWNER }}/${{ env.GIT_REPO }}/ | |
cache-from: type=gha,scope=${{ env.vcs_ref }}-image | |
cache-to: type=gha,mode=max,scope=${{ env.vcs_ref }}-image | |