From aca6a7794e6d9a6c699e02e55f4a411737ee247a Mon Sep 17 00:00:00 2001 From: Mohamed Elmoslemany <117270519+mo-c4t@users.noreply.github.com> Date: Mon, 18 Sep 2023 13:12:05 +0300 Subject: [PATCH] Suite tagging (#317) --- .github/workflows/docker.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dd8deac70..715ace066 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -75,3 +75,38 @@ jobs: gcloud auth configure-docker --quiet europe-west3-docker.pkg.dev docker push ${{ steps.setDefaults.outputs.docker_image }} gcloud run deploy camino-suite-${{ steps.setDefaults.outputs.build_env }} --image ${{ steps.setDefaults.outputs.docker_image }} --region=europe-west1 + + - name: checkout camino-suite + if: ${{ (github.event_name == 'push') && (steps.setDefaults.outputs.build_env == 'stage') }} + uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 + repository: 'chain4travel/camino-suite' + ref: 'refs/heads/suite-c4t' + path: './camino-suite' + token: '${{ secrets.GIT_TAGS_TOKEN }}' + + - name: Create suite tag + id: createTag + if: ${{ (github.event_name == 'push') && (steps.setDefaults.outputs.build_env == 'stage') }} + run: | + echo "create_tag=false" >> $GITHUB_OUTPUT + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + CURRENT_TAG=$(git describe --abbrev=0 --tags) + if [[ $CURRENT_TAG == *"-rc"* ]]; then + TAG=$(echo "$CURRENT_TAG"|awk -F'-rc' -v OFS='-rc' '{$2=sprintf("%1d",++$2)}7') + git tag -a $TAG -m "create tag $TAG for staging" + git push --tags + echo "create_tag=true" >> $GITHUB_OUTPUT + echo "suite_tag=$TAG" >> $GITHUB_OUTPUT + fi + + - name: Create tag + if: ${{ (github.event_name == 'push') && (steps.setDefaults.outputs.build_env == 'stage') && (steps.createTag.outputs.create_tag == 'true') }} + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git tag ${{ steps.createTag.outputs.suite_tag }} + git push --tags