Closed avdata99 closed 1 year ago
I like the idea, but not the implementation. It will be too easy for us to forget to edit the version in two different places, and the PR checklist will not apply to most PRs. We should keep the GIT_BRANCH
env var as the single source of truth for the version being built.
In the workflow definition we can extract the version in a first step and use it in the following ones:
diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml
index 3123abf..07e4f30 100644
--- a/.github/workflows/publish-docker.yml
+++ b/.github/workflows/publish-docker.yml
@@ -17,45 +17,49 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Set CKAN Versions
+ run: |
+ echo CKAN_VERSION_2.8=$(grep 'ENV GIT_BRANCH' ckan-base/2.8/Dockerfile | cut -d '-' -f 2) >> $GITHUB_ENV
+ echo CKAN_VERSION_2.9=$(grep 'ENV GIT_BRANCH' ckan-base/2.9/Dockerfile | cut -d '-' -f 2) >> $GITHUB_ENV
- name: Build ckan-base 2.8
uses: docker/build-push-action@v2
with:
context: ckan-base
file: ckan-base/2.8/Dockerfile
push: true
- tags: openknowledge/ckan-base:2.8
+ tags: openknowledge/ckan-base:2.8,openknowledge/ckan-base:${{ env.CKAN_VERSION_2.8 }}
- name: Build ckan-base 2.9
uses: docker/build-push-action@v2
with:
context: ckan-base
file: ckan-base/2.9/Dockerfile
push: true
- tags: openknowledge/ckan-base:2.9
+ tags: openknowledge/ckan-base:2.9,openknowledge/ckan-base:${{ env.CKAN_VERSION_2.9 }}
- name: Build ckan-base 2.9-py2
uses: docker/build-push-action@v2
with:
context: ckan-base
file: ckan-base/2.9/Dockerfile.py2
push: true
- tags: openknowledge/ckan-base:2.9-py2
+ tags: openknowledge/ckan-base:2.9-py2,openknowledge/ckan-base:${{ env.CKAN_VERSION_2.9 }}-py2
- name: Build ckan-dev 2.8
uses: docker/build-push-action@v2
with:
context: ckan-dev
file: ckan-dev/2.8/Dockerfile
push: true
- tags: openknowledge/ckan-dev:2.8
+ tags: openknowledge/ckan-dev:2.8,openknowledge/ckan-dev:${{ env.CKAN_VERSION_2.8 }}
- name: Build ckan-dev 2.9
uses: docker/build-push-action@v2
with:
context: ckan-dev
file: ckan-dev/2.9/Dockerfile
push: true
- tags: openknowledge/ckan-dev:2.9
+ tags: openknowledge/ckan-dev:2.9,openknowledge/ckan-dev:${{ env.CKAN_VERSION_2.9 }}
- name: Build ckan-dev 2.9-py2
uses: docker/build-push-action@v2
with:
context: ckan-dev
file: ckan-dev/2.9/Dockerfile.py2
push: true
- tags: openknowledge/ckan-dev:2.9-py2
+ tags: openknowledge/ckan-dev:2.9-py2,openknowledge/ckan-dev:${{ env.CKAN_VERSION_2.9 }}-py2
Looks good @avdata99, let's give it a go!
It will be nice to have docker images for CKAN 2.9.6, 2.8.11 and next minor releases
This PR also includes a template for PRs. I tried to use another approach to avoid forgetting to update the version in the github action files, but I didn't like it