2022-07-14 14:00:06 +02:00
|
|
|
name: start-linux-amd64
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- testing
|
|
|
|
- staging
|
|
|
|
- '1.9'
|
|
|
|
- master
|
|
|
|
|
|
|
|
concurrency: ci-x64-${{ github.ref }}
|
|
|
|
|
|
|
|
###############################################
|
|
|
|
# REQUIRED secrets
|
|
|
|
# ${{ secrets.Docker_Login }}
|
|
|
|
# Username of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
|
|
|
# ${{ secrets.Docker_Password }}
|
|
|
|
# Password of docker login for pushing the images to repo env.DOCKER_ORG and env.DOCKER_ORG_TESTS
|
|
|
|
# Add the above secrets to your github repo to determine where the images will be pushed.
|
|
|
|
################################################
|
|
|
|
# REQUIRED global variables
|
|
|
|
# DOCKER_ORG, docker org used for pushing release images (branch x.y and master)
|
|
|
|
# DOCKER_ORG_TEST, docker org used for pushing images for testing (branch testing).
|
|
|
|
env:
|
|
|
|
DOCKER_ORG: mailu
|
|
|
|
DOCKER_ORG_TEST: mailuci
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# This job calculates all global job variables that are required by all the subsequent jobs.
|
|
|
|
# All subsequent jobs will retrieve and use these variables. This way the variables only have to be derived once.
|
|
|
|
derive-variables:
|
|
|
|
name: derive variables
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
MAILU_VERSION: ${{ env.MAILU_VERSION }}
|
|
|
|
PINNED_MAILU_VERSION: ${{ env.PINNED_MAILU_VERSION }}
|
|
|
|
DOCKER_ORG: ${{ env.DOCKER_ORG_DERIVED }}
|
|
|
|
BRANCH: ${{ env.BRANCH }}
|
|
|
|
DEPLOY: ${{ env.DEPLOY }}
|
|
|
|
RELEASE: ${{ env.RELEASE }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetch-depth 0 is required to also retrieve all tags.
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Extract branch name
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
|
|
|
#For branch TESTING, we set the image tag to pr-xxxx
|
|
|
|
- name: Derive MAILU_VERSION and PINNED_MAILU_VERSION and DEPLOY/RELEASE for branch testing
|
|
|
|
if: env.BRANCH == 'testing'
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
|
|
run: |
|
|
|
|
echo "MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
|
|
|
echo "PINNED_MAILU_VERSION=pr-${COMMIT_MESSAGE//[!0-9]/}" >> $GITHUB_ENV
|
|
|
|
echo "DOCKER_ORG_DERIVED=${{ env.DOCKER_ORG_TEST }}" >> $GITHUB_ENV
|
|
|
|
echo "DEPLOY=true" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE=false" >> $GITHUB_ENV
|
|
|
|
- name: Derive MAILU_VERSION and DEPLOY/RELEASE for other branches than testing
|
|
|
|
if: env.BRANCH != 'testing'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "MAILU_VERSION=${{ env.BRANCH }}" >> $GITHUB_ENV
|
|
|
|
echo "DOCKER_ORG_DERIVED=${{ env.DOCKER_ORG }}" >> $GITHUB_ENV
|
|
|
|
echo "DEPLOY=true" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE=false" >> $GITHUB_ENV
|
|
|
|
- name: Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
|
|
|
if: env.BRANCH != 'testing' && env.BRANCH != 'staging' && env.BRANCH != 'master'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
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
|
|
|
|
echo "RELEASE=true" >> $GITHUB_ENV
|
|
|
|
echo "DEPLOY=true" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE=true" >> $GITHUB_ENV
|
|
|
|
- name: Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for staging
|
|
|
|
id: deploy
|
|
|
|
if: env.BRANCH == 'staging'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "PINNED_MAILU_VERSION=staging" >> $GITHUB_ENV
|
|
|
|
echo "DEPLOY=false" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE=false" >> $GITHUB_ENV
|
2022-10-28 13:52:49 +02:00
|
|
|
- name: Derive PINNED_MAILU_VERSION for master
|
2022-07-14 14:00:06 +02:00
|
|
|
if: env.BRANCH == 'master'
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
GITHUB_SHA: ${{ env.GITHUB_SHA }}
|
|
|
|
run: |
|
|
|
|
echo "PINNED_MAILU_VERSION=$GITHUB_SHA" >> $GITHUB_ENV
|
|
|
|
echo "DEPLOY=true" >> $GITHUB_ENV
|
|
|
|
echo "RELEASE=false" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
build-test-deploy:
|
|
|
|
needs:
|
|
|
|
- derive-variables
|
|
|
|
uses: ./.github/workflows/build_test_deploy.yml
|
|
|
|
with:
|
|
|
|
architecture: 'linux/amd64'
|
|
|
|
mailu_version: ${{needs.derive-variables.outputs.MAILU_VERSION}}
|
|
|
|
pinned_mailu_version: ${{needs.derive-variables.outputs.PINNED_MAILU_VERSION}}
|
|
|
|
docker_org: ${{needs.derive-variables.outputs.DOCKER_ORG}}
|
|
|
|
branch: ${{needs.derive-variables.outputs.BRANCH}}
|
|
|
|
deploy: ${{needs.derive-variables.outputs.DEPLOY}}
|
|
|
|
release: ${{needs.derive-variables.outputs.RELEASE}}
|
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
# This job is watched by bors. It only complets if building,testing and deploy worked.
|
|
|
|
ci-success:
|
|
|
|
name: CI-Done
|
|
|
|
#Returns true when none of the **previous** steps have failed or have been canceled.
|
|
|
|
if: success()
|
|
|
|
needs:
|
|
|
|
- build-test-deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: CI/CD succeeded.
|
|
|
|
run: exit 0
|
|
|
|
|
|
|
|
################################################
|
|
|
|
# Code block that is used as one liner for the step:
|
|
|
|
# Derive PINNED_MAILU_VERSION and DEPLOY/RELEASE for normal release x.y
|
|
|
|
##!/bin/bash
|
|
|
|
#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
|
2022-10-28 13:52:49 +02:00
|
|
|
#echo "PINNED_MAILU_VERSION=$pinned_version" >> $GITHUB_ENV
|