From 832bcb1609bc130c464d42d577e08ebe7b341b08 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Tue, 26 Sep 2023 22:17:41 +0200 Subject: [PATCH] fix(docker): Set correct version for runtime Main version is caught in the same manner as the docker_build script, with gradlew. Tag event will create the version with defined tag. Signed-off-by: Helio Chissini de Castro --- .github/workflows/docker-ort-runtime-ext.yml | 11 ++++++++++- .github/workflows/docker-ort-runtime.yml | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-ort-runtime-ext.yml b/.github/workflows/docker-ort-runtime-ext.yml index 8ed0ebcf35981..1e501d66e2d7d 100644 --- a/.github/workflows/docker-ort-runtime-ext.yml +++ b/.github/workflows/docker-ort-runtime-ext.yml @@ -24,6 +24,8 @@ on: - '.versions' - 'Dockerfile' - 'Dockerfile-extended' + - '.github/workflows/docker-ort-runtime.yml' + - '.github/workflows/docker-ort-runtime-ext.yml' push: branches: - main @@ -163,6 +165,11 @@ jobs: - name: Checkout default branch uses: actions/checkout@v4 + - name: Get ORT current version + run: | + ORT_VERSION=$(./gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") + echo "ORT_VERSION=${ORT_VERSION}" >> $GITHUB_ENV + - name: Set up Docker build uses: docker/setup-buildx-action@v2 @@ -180,7 +187,9 @@ jobs: images: | ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort-extended tags: | - type=raw,sha,enable=true,format=short + type=schedule,pattern={{date 'YYYYMMDD'}} + type=pep440,pattern={{version}} + type=raw,value=${{ env.ORT_VERSION }} - name: Build ORT extended runtime image uses: docker/build-push-action@v5 diff --git a/.github/workflows/docker-ort-runtime.yml b/.github/workflows/docker-ort-runtime.yml index 8d7d4df83a57a..03ca9443f5708 100644 --- a/.github/workflows/docker-ort-runtime.yml +++ b/.github/workflows/docker-ort-runtime.yml @@ -23,6 +23,7 @@ on: paths: - '.versions' - 'Dockerfile' + - '.github/workflows/docker-ort-runtime.yml' push: branches: - main @@ -177,6 +178,11 @@ jobs: run: | cat .versions >> $GITHUB_ENV + - name: Get ORT current version + run: | + ORT_VERSION=$(./gradlew -q properties --property version | sed -nr "s/version: (.+)/\1/p") + echo "ORT_VERSION=${ORT_VERSION}" >> $GITHUB_ENV + - name: Set up Docker build uses: docker/setup-buildx-action@v2 @@ -194,7 +200,9 @@ jobs: images: | ${{ env.REGISTRY }}/${{ github.repository_owner }}/ort tags: | - type=raw,sha,enable=true,format=short + type=schedule,pattern={{date 'YYYYMMDD'}} + type=pep440,pattern={{version}} + type=raw,value=${{ env.ORT_VERSION }} - name: Build ORT runtime image if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}