mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2025-01-03 11:21:44 +01:00
Determin the proper image for caching for the build
This commit is contained in:
parent
4727162002
commit
4faea7ed20
1 changed files with 8 additions and 1 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
@ -54,11 +54,17 @@ jobs:
|
||||||
PUBLISH_IMAGE=false
|
PUBLISH_IMAGE=false
|
||||||
TAGS="${{ env.image-name }}:dev"
|
TAGS="${{ env.image-name }}:dev"
|
||||||
|
|
||||||
|
# Define the image that will be used as a cached image
|
||||||
|
# to speed up the build process
|
||||||
|
BUILD_CACHE_IMAGE_NAME=${TAGS}
|
||||||
|
|
||||||
if [[ $GITHUB_REF_NAME == master ]] || [[ $GITHUB_REF_NAME == main ]]; then
|
if [[ $GITHUB_REF_NAME == master ]] || [[ $GITHUB_REF_NAME == main ]]; then
|
||||||
# when building master/main use :latest tag and the version number
|
# when building master/main use :latest tag and the version number
|
||||||
# from the cbpi/__init__.py file
|
# from the cbpi/__init__.py file
|
||||||
VERSION=$(grep -o -E "(([0-9]{1,2}[.]?){3}[0-9]+)" cbpi/__init__.py)
|
VERSION=$(grep -o -E "(([0-9]{1,2}[.]?){3}[0-9]+)" cbpi/__init__.py)
|
||||||
TAGS="${{ env.image-name }}:latest,${{ env.image-name }}:v${VERSION}"
|
LATEST_IMAGE=${{ env.image-name }}:latest
|
||||||
|
BUILD_CACHE_IMAGE_NAME=${LATEST_IMAGE}
|
||||||
|
TAGS="${LATEST_IMAGE},${{ env.image-name }}:v${VERSION}"
|
||||||
PUBLISH_IMAGE=true
|
PUBLISH_IMAGE=true
|
||||||
elif [[ $GITHUB_REF_NAME == development ]]; then
|
elif [[ $GITHUB_REF_NAME == development ]]; then
|
||||||
PUBLISH_IMAGE=true
|
PUBLISH_IMAGE=true
|
||||||
|
@ -67,6 +73,7 @@ jobs:
|
||||||
# Set output parameters.
|
# Set output parameters.
|
||||||
echo ::set-output name=tags::${TAGS}
|
echo ::set-output name=tags::${TAGS}
|
||||||
echo ::set-output name=publish_image::${PUBLISH_IMAGE}
|
echo ::set-output name=publish_image::${PUBLISH_IMAGE}
|
||||||
|
echo ::set-output name=build_cache_image_name::${BUILD_CACHE_IMAGE_NAME}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@master
|
uses: docker/setup-qemu-action@master
|
||||||
|
|
Loading…
Reference in a new issue