gha: restore arm build. #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build image | |
on: | |
push: | |
branches-ignore: | |
- main | |
- master | |
tags: | |
- 'v*' | |
jobs: | |
build_cfg: | |
runs-on: ubuntu-latest | |
environment: default | |
outputs: | |
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }} | |
ALT_TAGS: ${{ steps.config_step.outputs.ALT_TAGS }} | |
steps: | |
- name: "Determine Version" | |
id: config_step | |
run: |- | |
#VER_KIND = 'alpha' (not deployed) | 'dev' | 'beta' | 'gold' | |
VER_KIND=alpha | |
VER_BUILD=$(date +%H%M) | |
# limit to only first 3 chars | |
VER_BUILD=${VER_BUILD:0:3} | |
# 'strict' semver segments cannot start with 0 | |
VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}" | |
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT | |
# recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int. | |
VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}" | |
echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT | |
REF_NAME="${{ github.ref_name }}" | |
if [[ ${REF_NAME} =~ ^(v)([[:digit:]]+\..*)$ ]]; then | |
VER_KIND=gold | |
VERSION_STR=${BASH_REMATCH[2]} | |
else | |
VERSION_STR=ci-${VERSION_NUM} | |
ALT_TAGS="" | |
if [[ "${REF_NAME}" == "develop" ]]; then | |
ALT_TAGS+=",ci-develop" | |
else | |
ALT_TAGS=",ci-dev-${REF_NAME#**/}" | |
fi | |
fi | |
echo "VERSION_STR=${VERSION_STR}" >> $GITHUB_OUTPUT | |
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT | |
echo "::notice::Version KIND=${VER_KIND}, STR=${VERSION_STR}${ALT_TAGS}, INT=${VERSION_INT}" | |
#endjob build_cfg | |
trigger-build: | |
runs-on: ubuntu-latest | |
needs: [build_cfg] | |
environment: default | |
env: | |
K8S_PROJECT: pulse-engage-mailroom | |
K8S_CONTAINER: mailroom | |
SLACK_DEPLOY_MSG: | |
steps: | |
- name: "Trigger Container Build" | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.CI_WEBHOOK_TOKEN }} | |
repository: istresearch/ci-docker | |
event-type: build-repo | |
client-payload: |- | |
{ | |
"repo": { | |
"name": "${{ github.repository }}", | |
"ref_type": "${{ github.ref_type }}", | |
"ref_name": "${{ github.ref_name }}" | |
}, | |
"image": { | |
"dockerfile": "Dockerfile", | |
"arch_allowed": "amd64 arm64", | |
"name": "${{ github.repository }}", | |
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}", | |
"build_args": [ | |
] | |
}, | |
"deployment": { | |
"deploy_flag": "${{ github.ref_type == 'branch' }}", | |
"k8s_project": "${{ env.K8S_PROJECT }}", | |
"k8s_container": "${{ env.K8S_CONTAINER }}", | |
"deploy_msg": "${{ env.SLACK_DEPLOY_MSG }}" | |
}, | |
"callback": { | |
"repository": "${{ github.repository }}", | |
"event_type": "build_image_result", | |
"error_type": "build_image_error" | |
} | |
} | |
#endjob trigger-build |