Build docker images #339
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 docker images | |
'on': | |
push: | |
paths-ignore: | |
- '**/*.md' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]*' | |
branches: | |
- 'build_dockers*' | |
schedule: | |
- cron: '05 00 * * *' | |
workflow_dispatch: | |
inputs: | |
# toolchain: | |
# type: string | |
# description: 'Rust toolchain' | |
version: | |
type: string | |
description: 'override image tag/version' | |
tag_alias: | |
type: string | |
description: 'image tag alias' | |
platforms: | |
default: linux/amd64 | |
description: 'docker platform(s)' | |
type: choice | |
options: | |
- linux/amd64 | |
- linux/arm64 | |
- linux/arm64, linux/amd64 | |
build_items: | |
default: minotari_all | |
description: 'image(s) to build' | |
type: choice | |
options: | |
- all | |
- minotari_all | |
- minotari_node | |
- minotari_console_wallet | |
- minotari_merge_mining_proxy | |
- minotari_sha3_miner | |
- 3rdparty_all | |
- tor | |
- monerod | |
- xmrig | |
env: | |
toolchain_default: nightly-2023-06-04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
builds_envs_setup: | |
runs-on: ubuntu-latest | |
outputs: | |
toolchain: ${{ steps.envs_setup.outputs.toolchain }} | |
platforms: ${{ steps.envs_setup.outputs.platforms }} | |
version: ${{ steps.envs_setup.outputs.version }} | |
tag_alias: ${{ steps.envs_setup.outputs.tag_alias }} | |
build_items: ${{ steps.envs_setup.outputs.build_items }} | |
steps: | |
- name: envs setup | |
id: envs_setup | |
shell: bash | |
run: | | |
echo "Workflow triggered by ${{ github.actor }} for ${{ github.event_name }}" | |
echo "SHA - ${GITHUB_SHA}" | |
VSHA_SHORT=$(echo ${GITHUB_SHA::7}) | |
echo "SHA short - ${VSHA_SHORT}" | |
echo "VSHA_SHORT=${VSHA_SHORT}" >> $GITHUB_ENV | |
TOOLCHAIN=${{ github.event.inputs.toolchain }} | |
echo "toolchain=${TOOLCHAIN:-${{ env.toolchain_default }}}" >> $GITHUB_OUTPUT | |
if [[ "${{ github.ref }}" =~ ^refs/tags/v* ]] && [ "${{ github.event_name }}" != "workflow_dispatch" ] ; then | |
echo "Tagged Build - Build everything" | |
VERSION="${{ github.ref_name }}_$(date -u '+%Y%m%d')_${VSHA_SHORT}" | |
echo "Version used - ${VERSION}" | |
echo "platforms=linux/arm64, linux/amd64" >> $GITHUB_OUTPUT | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
echo "tag_alias=latest" >> $GITHUB_OUTPUT | |
echo "build_items=all" >> $GITHUB_OUTPUT | |
fi | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ] ; then | |
echo "Manual Build - selective" | |
echo "platforms=${{ github.event.inputs.platforms }}" >> $GITHUB_OUTPUT | |
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
echo "tag_alias=${{ github.event.inputs.tag_alias }}" >> $GITHUB_OUTPUT | |
echo "build_items=${{ github.event.inputs.build_items }}" >> $GITHUB_OUTPUT | |
fi | |
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "05 00 * * *" ] ; then | |
echo "Daily Build - limited" | |
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT | |
echo "tag_alias=latest-daily" >> $GITHUB_OUTPUT | |
echo "build_items=minotari_all" >> $GITHUB_OUTPUT | |
fi | |
builds_run: | |
needs: builds_envs_setup | |
uses: ./.github/workflows/build_dockers_workflow.yml | |
secrets: inherit | |
with: | |
toolchain: ${{ needs.builds_envs_setup.outputs.toolchain }} | |
platforms: ${{ needs.builds_envs_setup.outputs.platforms }} | |
version: ${{ needs.builds_envs_setup.outputs.version }} | |
tag_alias: ${{ needs.builds_envs_setup.outputs.tag_alias }} | |
build_items: ${{ needs.builds_envs_setup.outputs.build_items }} |