Tag for release is correctly tagged to branch x.y.

master
Dimitri Huisman 3 years ago
parent d3db047fcc
commit cf328cdf33

@ -26,7 +26,7 @@ concurrency: ci-${{ github.ref }}
################################################ ################################################
# Code block that is used as one liner. # Code block that is used as one liner.
##!/bin/bash ##!/bin/bash
#version=$( git tag --list "{{ env.MAILU_VERSION }}.*" | tail -1 ) #version=$( git tag --sort=version:refname --list "{{ env.MAILU_VERSION }}.*" | tail -1 ) )
#root_version=${version%.*} #root_version=${version%.*}
#patch_version=${version##*.} #patch_version=${version##*.}
#if [ "$patch_version" == "" ] #if [ "$patch_version" == "" ]
@ -73,7 +73,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -149,7 +149,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -221,7 +221,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -293,7 +293,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -365,7 +365,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -437,7 +437,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -509,7 +509,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -587,7 +587,7 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Derive PINNED_MAILU_VERSION for staging - name: Derive PINNED_MAILU_VERSION for staging
if: ${{ env.BRANCH == 'staging' }} if: ${{ env.BRANCH == 'staging' }}
shell: bash shell: bash
@ -649,13 +649,19 @@ jobs:
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' }}
shell: bash shell: bash
run: | run: |
version=$( git tag --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV version=$( git tag --sort=version:refname --list "${{ env.MAILU_VERSION }}.*" | tail -1 );root_version=${version%.*};patch_version=${version##*.};if [ "$patch_version" == "" ]; then pinned_version=${{ env.MAILU_VERSION }}.0; else pinned_version=$root_version.$(expr $patch_version + 1); fi;echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
- name: Tag and create release - name: Create tag for branch x.y.
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }}
shell: bash
run: |
echo git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git log -1 --format='%H')
git tag ${{ env.PINNED_MAILU_VERSION }} $(/usr/bin/git log -1 --format='%H')
git push origin ${{ env.PINNED_MAILU_VERSION }}
- name: Create release for tag x.y.z.
if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }} if: ${{ env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master' && env.PINNED_MAILU_VERSION != '' }}
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1
with: with:
bodyFile: "RELEASE_TEMPLATE.md" bodyFile: "RELEASE_TEMPLATE.md"
commit: ${{ env.GITHUB_SHA }}
tag: ${{ env.PINNED_MAILU_VERSION }} tag: ${{ env.PINNED_MAILU_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

@ -0,0 +1 @@
Fix CI/CD workflow. Tags were not set to the correct commit hash.
Loading…
Cancel
Save