Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Feature: push the hash alongside of branch in master (#6593)
NyanKiyoshi9dfd1af5f009
diff --git a/.github/workflows/publish-containers.rst b/.github/workflows/publish-containers.rstindex 7921338e0c..3548e5a34a 100644--- a/.github/workflows/publish-containers.rst+++ b/.github/workflows/publish-containers.rst@@ -19,3 +19,27 @@ Tagging Process| ``refs/heads/preview/my-feature`` | docker.io/mirumee/saleor:my-feature || | docker.io/mirumee/saleor:sha-d122141d318518e216fc0e5b657259de317318c5 |+-----------------------------------+-----------------------------------------------------------------------++++Version Label and Argument for Dockerfile+-----------------------------------------++When the image is built, the following instructions will be provided to the below attached values in the dockerfile:++.. code-block:: docker++ ARG VERSION=<NAMED_VERSION>+ LABEL org.opencontainers.image.version=<NAMED_VERSION>++++-----------------------------------+--------------------------------------------------------++| Git Ref | Open Containers Version Value (``<NAMED_VERSION>``) |++===================================+========================================================++| ``refs/tags/1.0.0`` | 1.0.0 |++-----------------------------------+--------------------------------------------------------++| ``refs/tags/1.0.0a1`` | 1.0.0a1 |++-----------------------------------+--------------------------------------------------------++| ``refs/heads/master`` | heads/master-0-g8ccaf9 |++-----------------------------------+--------------------------------------------------------++| ``refs/heads/preview/my-feature`` | heads/preview/my-feature-0-gd12214 |++-----------------------------------+--------------------------------------------------------+diff --git a/.github/workflows/publish-containers.yml b/.github/workflows/publish-containers.ymlindex 2ab281c66c..89ef85cbbc 100644--- a/.github/workflows/publish-containers.yml+++ b/.github/workflows/publish-containers.yml@@ -7,11 +7,11 @@ on:- "[0-9]+.[0-9]+.[0-9]+*"branches:- master- - ci/*/*+ - ci/**jobs:docker:- runs-on: ubuntu-latest+ runs-on: ubuntu-20.04steps:- name: Checkoutuses: actions/checkout@v2@@ -33,6 +33,8 @@ jobs:id: taggedif: ${{ startsWith(github.ref, 'refs/tags/') }}run: |+ set -x+# Remove everything else than the tagged versionVERSION=${GITHUB_REF#refs/tags/}@@ -54,7 +56,8 @@ jobs:# Output the target tagsecho "CONTAINER_TAGS=${TAGS}- NAMED_VERSION=${NAMED_VERSION}" >> "${GITHUB_ENV}"+ NAMED_VERSION=${NAMED_VERSION}+ " >> "${GITHUB_ENV}"# Outputs the containers tags for staging branches# Only publishes them onto Docker Hub@@ -62,22 +65,29 @@ jobs:id: stagingif: ${{ startsWith(github.ref, 'refs/heads/') }}run: |+ set -x+# Version name is the branch name# Slashes are substitued by dashes- NAMED_VERSION=$(echo ${GITHUB_REF#refs/heads/} | tr / -)+ CLEAN_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)SHA=${GITHUB_SHA}# Target Docker Hub with the SHA value# and branch nameTAGS=$"\- ${{ steps.image.outputs.image_name }}:${NAMED_VERSION},\+ ${{ steps.image.outputs.image_name }}:${CLEAN_BRANCH_NAME},\${{ steps.image.outputs.image_name }}:sha-${SHA}\"+ # Set version name for open-containers version label as:+ # <branch>-<drift>-g<6-digit-hash>+ NAMED_VERSION=$(git describe --all --long | tr -d $'\n')+# Output the target tagsecho "CONTAINER_TAGS=${TAGS}- NAMED_VERSION=${NAMED_VERSION}" >> "${GITHUB_ENV}"+ NAMED_VERSION=${NAMED_VERSION}+ " >> "${GITHUB_ENV}"- name: Set up QEMUuses: docker/setup-qemu-action@v1@@ -123,7 +133,7 @@ jobs:cache-from: type=local,src=/tmp/.buildx-cachecache-to: type=local,dest=/tmp/.buildx-cachebuild-args: |- VERSION=${{ env.NAMED_VERSION }}+ PROJECT_VERSION=${{ env.NAMED_VERSION }}COMMIT_ID=${{ github.sha }}- name: Image digestdiff --git a/Dockerfile b/Dockerfileindex 29bf1e901e..70740e53ff 100644--- a/Dockerfile+++ b/Dockerfile@@ -46,7 +46,8 @@ EXPOSE 8000ENV PYTHONUNBUFFERED 1ARG COMMIT_ID-ARG VERSION+ARG PROJECT_VERSION+ENV PROJECT_VERSION="${PROJECT_VERSION}"LABEL org.opencontainers.image.title="mirumee/saleor" \org.opencontainers.image.description="\@@ -54,8 +55,8 @@ A modular, high performance, headless e-commerce platform built with Python, \GraphQL, Django, and ReactJS." \org.opencontainers.image.url="https://saleor.io/" \org.opencontainers.image.source="https://github.com/mirumee/saleor" \- org.opencontainers.image.revision=$COMMIT_ID \- org.opencontainers.image.version=$VERSION \+ org.opencontainers.image.revision="$COMMIT_ID" \+ org.opencontainers.image.version="$PROJECT_VERSION" \org.opencontainers.image.authors="Mirumee Software (https://mirumee.com)" \org.opencontainers.image.licenses="BSD 3"