Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-multistage-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Build multi-arch images
name: "Build multistage docker images (multi -flavours, -versions, -architectures)"

on:
workflow_call:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-multistage-configure.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Configure Pipeline for multistage docker images (multi -flavours, -versions, -architectures)"
name: "Configure multistage docker images (multi -flavours, -versions, -architectures)"

on:
workflow_call:
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/docker-multistage-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
name: "Push multistage docker images (multi -flavours, -versions, -architectures)"

on:
workflow_call:
###
### Variables
###
inputs:
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
matrix:
description: 'The build matrix'
required: true
type: string
has_refs:
description: 'The ref build matrix as JSON string (list of git refs to build/deploy).'
required: true
type: string
artifact_prefix:
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
required: true
type: string
flavour:
description: 'The flavour to build (Examples: base, mods, prod or work).'
required: true
type: string
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: true
dockerhub_password:
description: 'The password for Dockerhub.'
required: true

jobs:
# -----------------------------------------------------------------------------------------------
# JOB: DEPLOY
# -----------------------------------------------------------------------------------------------
test:
name: ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.flavour }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.matrix) }}
steps:

# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository (current)"
uses: actions/checkout@v3
with:
fetch-depth: 0
if: inputs.has_refs == 0

- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ matrix.refs }}
if: inputs.has_refs != 0

- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag-action@v0.4.15

- name: "[SETUP] Set artifact names"
id: set-artifact-name
run: |
PRE_HASH="$( git rev-parse HEAD | head -c 10 )"
VERSION="${{ matrix.version }}"
ARCH="$( echo "${{ matrix.arch }}" | sed 's|/|-|g' )"

NAME_CURR="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-${{ inputs.flavour }}"
echo "::set-output name=curr::${NAME_CURR}"


# ------------------------------------------------------------
# Artifact Import
# ------------------------------------------------------------

###
### Download and import previously built image
###
- name: "[Artifact Load] Download previously built image"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.curr }}
attempt_limit: 20
attempt_delay: 10000

- name: "[Artifact Load] Import previously built image"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.curr }}


# ------------------------------------------------------------
# Re-tag images
# ------------------------------------------------------------
- name: "[Docker Tag] Retag"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make tag VERSION=${{ matrix.version }} FLAVOUR=${{ inputs.flavour }} TAG=${{ steps.tag.outputs.docker-tag }}

- name: "[Docker Tag] Show images"
run: |
docker images


# ------------------------------------------------------------
# Login
# ------------------------------------------------------------
- name: Login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
if: ${{ inputs.can_deploy }}


# ------------------------------------------------------------
# Push images
# ------------------------------------------------------------
- name: Push Image
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make push VERSION=${{ matrix.version }} FLAVOUR=${{ inputs.flavour }} TAG=${{ steps.tag.outputs.docker-tag }}
if: ${{ inputs.can_deploy }}
2 changes: 1 addition & 1 deletion .github/workflows/docker-multistage-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Test multi-arch images
name: "Test multistage docker images (multi -flavours, -versions, -architectures)"

on:
workflow_call:
Expand Down