Clean GitHub Actions

This commit is contained in:
cytopia
2022-03-30 13:09:30 +02:00
parent 476a1dee47
commit 1b02bd11fe
14 changed files with 642 additions and 2022 deletions

View File

@@ -3,15 +3,16 @@
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: build
name: nightly
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
jobs:
@@ -20,7 +21,7 @@ jobs:
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params.yml
uses: ./.github/workflows/params-nightly_master.yml
# -----------------------------------------------------------------------------------------------
@@ -31,8 +32,8 @@ jobs:
uses: devilbox/github-actions/.github/workflows/docker-multistage-configure.yml@master
with:
enabled: true
can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
is_scheduled: false
can_deploy: true
is_scheduled: true
versions: ${{ needs.params.outputs.versions }}
refs: ${{ needs.params.outputs.refs }}
secrets:

View File

@@ -0,0 +1,296 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: nightly
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params-nightly_tags.yml
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: devilbox/github-actions/.github/workflows/docker-multistage-configure.yml@master
with:
enabled: true
can_deploy: true
is_scheduled: true
versions: ${{ needs.params.outputs.versions }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- configure
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
stage_prev: ''
base-test:
needs:
- configure
- base
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- configure
- base
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
stage_prev: base
mods-test:
needs:
- configure
- mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- configure
- mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
stage_prev: mods
prod-test:
needs:
- configure
- prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- configure
- prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: true
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
stage_prev: prod
work-test:
needs:
- configure
- work
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-base:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-mods:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-prod:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-work:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
manifest-base:
needs:
- configure
- push-base
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: base
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-mods:
needs:
- configure
- push-mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-prod:
needs:
- configure
- push-prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: prod
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-work:
needs:
- configure
- push-work
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: work
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

296
.github/workflows/action.yml vendored Normal file
View File

@@ -0,0 +1,296 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: build
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
push:
pull_request:
workflow_dispatch:
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params.yml
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: devilbox/github-actions/.github/workflows/docker-multistage-configure.yml@master
with:
enabled: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.user.login != github.repository_owner) }}
can_deploy: ${{ (github.repository == 'devilbox/docker-php-fpm') && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-')) }}
is_scheduled: false
versions: ${{ needs.params.outputs.versions }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- configure
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
stage_prev: ''
base-test:
needs:
- configure
- base
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- configure
- base
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
stage_prev: base
mods-test:
needs:
- configure
- mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- configure
- mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: false
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
stage_prev: mods
prod-test:
needs:
- configure
- prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- configure
- prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-build.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
run_tests: true
upload_artifact: true
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
stage_prev: prod
work-test:
needs:
- configure
- work
uses: devilbox/github-actions/.github/workflows/docker-multistage-test.yml@master
with:
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-base:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: base
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-mods:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-prod:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: prod
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
push-work:
needs:
- configure
- base-test
- prod-test
- mods-test
- work-test
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-image.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_build }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
stage: work
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
manifest-base:
needs:
- configure
- push-base
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: base
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-mods:
needs:
- configure
- push-mods
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-prod:
needs:
- configure
- push-prod
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: prod
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
manifest-work:
needs:
- configure
- push-work
uses: devilbox/github-actions/.github/workflows/docker-multistage-push-manifest.yml@master
with:
can_deploy: ${{ needs.configure.outputs.can_login == 'true' && needs.configure.outputs.can_push == 'true' }}
has_refs: ${{ needs.configure.outputs.has_refs == 'true' }}
matrix: ${{ needs.configure.outputs.matrix_deploy }}
versions: ${{ needs.configure.outputs.versions }}
stage: work
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

View File

@@ -1,259 +0,0 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: build
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
workflow_dispatch:
pull_request:
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params.yml
# Only run for forks (contributor)
if: github.event.pull_request.head.repo.fork
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: ./.github/workflows/zzz-reuse-configure.yml
with:
enabled: true
can_deploy: false
matrix: ${{ needs.params.outputs.matrix }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ""
dockerhub_password: ""
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- params
- configure
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: base
run_tests: true
secrets:
dockerhub_username: ""
dockerhub_password: ""
#base-test:
# needs:
# - params
# - configure
# - base
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: base
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- params
- configure
- base
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
run_tests: false
secrets:
dockerhub_username: ""
dockerhub_password: ""
mods-test:
needs:
- params
- configure
- base
- mods
uses: ./.github/workflows/zzz-reuse-test.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
secrets:
dockerhub_username: ""
dockerhub_password: ""
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- params
- configure
- base
- mods
- mods-test
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: prod
run_tests: true
secrets:
dockerhub_username: ""
dockerhub_password: ""
#prod-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: prod
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- params
- configure
- base
- mods
- prod
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: work
run_tests: true
secrets:
dockerhub_username: ""
dockerhub_password: ""
#work-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# - prod-test
# - work
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: work
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-image:
needs:
- params
- configure
- base
- mods
- prod
- work
uses: ./.github/workflows/zzz-reuse-deploy-images.yml
with:
enabled: true
can_deploy: false
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ""
dockerhub_password: ""
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
push-manifest:
needs:
- params
- configure
- base
- mods
- prod
- work
- push-image
uses: ./.github/workflows/zzz-reuse-deploy-manifests.yml
with:
enabled: true
can_deploy: false
deploy_matrix: ${{ needs.configure.outputs.matrix_deploy }}
params_matrix: ${{ needs.params.outputs.matrix }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ""
dockerhub_password: ""

View File

@@ -1,259 +0,0 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: nightly
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs daily
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params-nightly_master.yml
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: ./.github/workflows/zzz-reuse-configure.yml
with:
enabled: true
can_deploy: true
matrix: ${{ needs.params.outputs.matrix }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- params
- configure
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: base
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#base-test:
# needs:
# - params
# - configure
# - base
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: base
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- params
- configure
- base
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
run_tests: false
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
mods-test:
needs:
- params
- configure
- base
- mods
uses: ./.github/workflows/zzz-reuse-test.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- params
- configure
- base
- mods
- mods-test
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: prod
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#prod-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: prod
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- params
- configure
- base
- mods
- prod
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: work
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#work-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# - prod-test
# - work
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: work
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-image:
needs:
- params
- configure
- base
- mods
- prod
- work
uses: ./.github/workflows/zzz-reuse-deploy-images.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
push-manifest:
needs:
- params
- configure
- base
- mods
- prod
- work
- push-image
uses: ./.github/workflows/zzz-reuse-deploy-manifests.yml
with:
enabled: true
can_deploy: true
deploy_matrix: ${{ needs.configure.outputs.matrix_deploy }}
params_matrix: ${{ needs.params.outputs.matrix }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

View File

@@ -1,259 +0,0 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: nightly
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs daily
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params-nightly_tags.yml
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: ./.github/workflows/zzz-reuse-configure.yml
with:
enabled: true
can_deploy: true
matrix: ${{ needs.params.outputs.matrix }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- params
- configure
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: base
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#base-test:
# needs:
# - params
# - configure
# - base
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: base
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- params
- configure
- base
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
run_tests: false
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
mods-test:
needs:
- params
- configure
- base
- mods
uses: ./.github/workflows/zzz-reuse-test.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- params
- configure
- base
- mods
- mods-test
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: prod
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#prod-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: prod
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- params
- configure
- base
- mods
- prod
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: work
run_tests: true
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
#work-test:
# needs:
# - params
# - configure
# - base
# - base-test
# - mods
# - mods-test
# - prod
# - prod-test
# - work
# uses: ./.github/workflows/zzz-reuse-test.yml
# with:
# enabled: true
# can_deploy: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/release-') }}
# build_matrix: ${{ needs.configure.outputs.matrix_build }}
# has_refs: ${{ needs.configure.outputs.has_refs }}
# artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
# flavour: work
# secrets:
# dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
# dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-image:
needs:
- params
- configure
- base
- mods
- prod
- work
uses: ./.github/workflows/zzz-reuse-deploy-images.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
push-manifest:
needs:
- params
- configure
- base
- mods
- prod
- work
- push-image
uses: ./.github/workflows/zzz-reuse-deploy-manifests.yml
with:
enabled: true
can_deploy: true
deploy_matrix: ${{ needs.configure.outputs.matrix_deploy }}
params_matrix: ${{ needs.params.outputs.matrix }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

View File

@@ -10,7 +10,7 @@ name: params
# Custom Variables
# -------------------------------------------------------------------------------------------------
env:
MATRIX: >-
VERSIONS: >-
[
{
"NAME": "PHP",
@@ -25,6 +25,12 @@ env:
"ARCH": ["linux/amd64", "linux/arm64"]
}
]
REFS: >-
{
"DEFAULT_BRANCH": "master",
"BRANCHES": "master",
"NUM_LATEST_TAGS": 0
}
# -------------------------------------------------------------------------------------------------
@@ -32,12 +38,15 @@ env:
# -------------------------------------------------------------------------------------------------
on:
workflow_call:
###
### OUTPUTS
###
outputs:
matrix:
description: "The determined version matrix"
value: ${{ jobs.params.outputs.matrix }}
versions:
description: "JSON string for versions. Use via: fromJson(needs.params.versions)"
value: ${{ jobs.params.outputs.versions }}
refs:
description: "The determined git ref matrix (only during scheduled run)"
description: "JSON string for refs. Use via: fromJson(needs.params.refs)"
value: ${{ jobs.params.outputs.refs }}
jobs:
@@ -45,37 +54,16 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
refs: ${{ steps.set-refs.outputs.matrix }}
versions: ${{ steps.set-versions.outputs.versions }}
refs: ${{ steps.set-refs.outputs.refs }}
steps:
- name: "[Set-Output] Matrix"
id: set-matrix
- name: "[Set-Output] jsonify VERSIONS"
id: set-versions
run: |
echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )"
echo "::set-output name=versions::$( echo '${{ env.VERSIONS }}' | jq -M -c )"
- name: "[Set-Output] Matrix 'Refs' (master branch and latest tag)"
- name: "[Set-Output] jsonify REFS"
id: set-refs
uses: cytopia/git-ref-matrix-action@v0.1.4
with:
repository_default_branch: master
branches: master
num_latest_tags: 0
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
- name: "[DEBUG] Show settings'"
run: |
echo 'Matrix'
echo '--------------------'
echo '${{ steps.set-matrix.outputs.matrix }}'
echo
echo 'Matrix: Refs'
echo '--------------------'
echo '${{ steps.set-matrix-refs.outputs.matrix }}'
echo
echo 'GitHub event_name'
echo '--------------------'
echo '${{ github.event_name }}'
echo
echo "::set-output name=refs::$( echo '${{ env.REFS }}' | jq -M -c )"

View File

@@ -10,7 +10,7 @@ name: params
# Custom Variables
# -------------------------------------------------------------------------------------------------
env:
MATRIX: >-
VERSIONS: >-
[
{
"NAME": "PHP",
@@ -25,6 +25,12 @@ env:
"ARCH": ["linux/amd64", "linux/arm64"]
}
]
REFS: >-
{
"DEFAULT_BRANCH": "master",
"BRANCHES": "",
"NUM_LATEST_TAGS": 1
}
# -------------------------------------------------------------------------------------------------
@@ -32,12 +38,15 @@ env:
# -------------------------------------------------------------------------------------------------
on:
workflow_call:
###
### OUTPUTS
###
outputs:
matrix:
description: "The determined version matrix"
value: ${{ jobs.params.outputs.matrix }}
versions:
description: "JSON string for versions. Use via: fromJson(needs.params.versions)"
value: ${{ jobs.params.outputs.versions }}
refs:
description: "The determined git ref matrix (only during scheduled run)"
description: "JSON string for refs. Use via: fromJson(needs.params.refs)"
value: ${{ jobs.params.outputs.refs }}
jobs:
@@ -45,37 +54,16 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
refs: ${{ steps.set-refs.outputs.matrix }}
versions: ${{ steps.set-versions.outputs.versions }}
refs: ${{ steps.set-refs.outputs.refs }}
steps:
- name: "[Set-Output] Matrix"
id: set-matrix
- name: "[Set-Output] jsonify VERSIONS"
id: set-versions
run: |
echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )"
echo "::set-output name=versions::$( echo '${{ env.VERSIONS }}' | jq -M -c )"
- name: "[Set-Output] Matrix 'Refs' (master branch and latest tag)"
- name: "[Set-Output] jsonify REFS"
id: set-refs
uses: cytopia/git-ref-matrix-action@v0.1.4
with:
repository_default_branch: master
branches: ""
num_latest_tags: 1
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
- name: "[DEBUG] Show settings'"
run: |
echo 'Matrix'
echo '--------------------'
echo '${{ steps.set-matrix.outputs.matrix }}'
echo
echo 'Matrix: Refs'
echo '--------------------'
echo '${{ steps.set-matrix-refs.outputs.matrix }}'
echo
echo 'GitHub event_name'
echo '--------------------'
echo '${{ github.event_name }}'
echo
echo "::set-output name=refs::$( echo '${{ env.REFS }}' | jq -M -c )"

View File

@@ -36,8 +36,8 @@ env:
REFS: >-
{
"DEFAULT_BRANCH": "master",
"BRANCHES": "master",
"NUM_LATEST_TAGS": 1
"BRANCHES": "",
"NUM_LATEST_TAGS": 0
}

View File

@@ -1,430 +0,0 @@
---
name: Build multi-arch images
on:
workflow_call:
###
### Variables
###
inputs:
enabled:
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
required: true
type: boolean
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
build_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 (base, mods, prod or work).'
required: true
type: string
run_tests:
description: 'Dertermines weather we run integration tests or not.'
required: true
type: boolean
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: false
dockerhub_password:
description: 'The password for Dockerhub.'
required: false
jobs:
# -----------------------------------------------------------------------------------------------
# JOB: BUILD
# -----------------------------------------------------------------------------------------------
build:
name: ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.flavour }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.build_matrix) }}
if: inputs.enabled
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] 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_BASE="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-base"
NAME_MODS="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-mods"
NAME_PROD="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-prod"
NAME_WORK="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-work"
echo "::set-output name=base::${NAME_BASE}"
echo "::set-output name=mods::${NAME_MODS}"
echo "::set-output name=prod::${NAME_PROD}"
echo "::set-output name=work::${NAME_WORK}"
# ------------------------------------------------------------
# Artifact Import
# ------------------------------------------------------------
###
### Download and import base
###
- name: "[Artifact Load] Download base"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.base }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'mods' }}
- name: "[Artifact Load] Import base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.base }}
if: ${{ inputs.flavour == 'mods' }}
###
### Download and import mods
###
- name: "[Artifact Load] Download mods"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.mods }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'prod' }}
- name: "[Artifact Load] Import mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.mods }}
if: ${{ inputs.flavour == 'prod' }}
###
### Download and import prod
###
- name: "[Artifact Load] Download prod"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.prod }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'work' }}
- name: "[Artifact Load] Import prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.prod }}
if: ${{ inputs.flavour == 'work' }}
# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make build VERSION=${{ matrix.version }} FLAVOUR=${{ inputs.flavour }} ARCH=${{ matrix.arch }}
# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
- name: Test
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make test VERSION=${{ matrix.version }} FLAVOUR=${{ inputs.flavour }} ARCH=${{ matrix.arch }}
if: ${{ inputs.run_tests }}
# ------------------------------------------------------------
# Artifact Expot (base)
# ------------------------------------------------------------
###
### Export and Upload base
###
- name: "[Artifact Save] Export base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save-verify VERSION=${{ matrix.version }} FLAVOUR=base ARCH=${{ matrix.arch }} OUTFILE=${{ steps.set-artifact-name.outputs.base }} INFILE=${{ steps.set-artifact-name.outputs.base }}
if: ${{ inputs.flavour == 'base' }}
###
### Try 1
###
- name: "[Artifact Save] Upload base"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.base }}
path: ${{ steps.set-artifact-name.outputs.base }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'base' }}
- name: "[Artifact Save] Download base (verify)"
continue-on-error: true
id: download-base-1
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.base }}
path: ${{ steps.set-artifact-name.outputs.base }}.tmp
if: ${{ inputs.flavour == 'base' }}
###
### Try 2
###
- name: "[Artifact Save] Upload base (retry)"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.base }}
path: ${{ steps.set-artifact-name.outputs.base }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'base' && steps.download-base-1.outcome == 'failure'}}
- name: "[Artifact Save] Download base (verify 2)"
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.base }}
path: ${{ steps.set-artifact-name.outputs.base }}.tmp
if: ${{ inputs.flavour == 'base' && steps.download-base-1.outcome == 'failure'}}
# ------------------------------------------------------------
# Artifact Expot (mods)
# ------------------------------------------------------------
###
### Export and Upload mods
###
- name: "[Artifact Save] Export mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save-verify VERSION=${{ matrix.version }} FLAVOUR=mods ARCH=${{ matrix.arch }} OUTFILE=${{ steps.set-artifact-name.outputs.mods }} INFILE=${{ steps.set-artifact-name.outputs.mods }}
if: ${{ inputs.flavour == 'mods' }}
###
### Try 1
###
- name: "[Artifact Save] Upload mods"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.mods }}
path: ${{ steps.set-artifact-name.outputs.mods }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'mods' }}
- name: "[Artifact Save] Download mods (verify)"
continue-on-error: true
id: download-mods-1
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.mods }}
path: ${{ steps.set-artifact-name.outputs.mods }}.tmp
if: ${{ inputs.flavour == 'mods' }}
###
### Try 2
###
- name: "[Artifact Save] Upload mods (retry)"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.mods }}
path: ${{ steps.set-artifact-name.outputs.mods }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'mods' && steps.download-mods-1.outcome == 'failure'}}
- name: "[Artifact Save] Download mods (verify 2)"
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.mods }}
path: ${{ steps.set-artifact-name.outputs.mods }}.tmp
if: ${{ inputs.flavour == 'mods' && steps.download-mods-1.outcome == 'failure'}}
# ------------------------------------------------------------
# Artifact Expot (prod)
# ------------------------------------------------------------
###
### Export and Upload prod
###
- name: "[Artifact Save] Export prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save-verify VERSION=${{ matrix.version }} FLAVOUR=prod ARCH=${{ matrix.arch }} OUTFILE=${{ steps.set-artifact-name.outputs.prod }} INFILE=${{ steps.set-artifact-name.outputs.prod }}
if: ${{ inputs.flavour == 'prod' }}
###
### Try 1
###
- name: "[Artifact Save] Upload prod"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.prod }}
path: ${{ steps.set-artifact-name.outputs.prod }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'prod' }}
- name: "[Artifact Save] Download prod (verify)"
continue-on-error: true
id: download-prod-1
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.prod }}
path: ${{ steps.set-artifact-name.outputs.prod }}.tmp
if: ${{ inputs.flavour == 'prod' }}
###
### Try 2
###
- name: "[Artifact Save] Upload prod (retry)"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.prod }}
path: ${{ steps.set-artifact-name.outputs.prod }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'prod' && steps.download-prod-1.outcome == 'failure'}}
- name: "[Artifact Save] Download prod (verify 2)"
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.prod }}
path: ${{ steps.set-artifact-name.outputs.prod }}.tmp
if: ${{ inputs.flavour == 'prod' && steps.download-prod-1.outcome == 'failure'}}
# ------------------------------------------------------------
# Artifact Expot (work)
# ------------------------------------------------------------
###
### Export and Upload work
###
- name: "[Artifact Save] Export work"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save-verify VERSION=${{ matrix.version }} FLAVOUR=work ARCH=${{ matrix.arch }} OUTFILE=${{ steps.set-artifact-name.outputs.work }} INFILE=${{ steps.set-artifact-name.outputs.work }}
if: ${{ inputs.flavour == 'work' }}
###
### Try 1
###
- name: "[Artifact Save] Upload work"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.work }}
path: ${{ steps.set-artifact-name.outputs.work }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'work' }}
- name: "[Artifact Save] Download work (verify)"
continue-on-error: true
id: download-work-1
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.work }}
path: ${{ steps.set-artifact-name.outputs.work }}.tmp
if: ${{ inputs.flavour == 'work' }}
###
### Try 2
###
- name: "[Artifact Save] Upload work (retry)"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/upload-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.work }}
path: ${{ steps.set-artifact-name.outputs.work }}
if-no-files-found: error
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'work' && steps.download-work-1.outcome == 'failure'}}
- name: "[Artifact Save] Download work (verify 2)"
uses: actions/download-artifact@v3
with:
name: ${{ steps.set-artifact-name.outputs.work }}
path: ${{ steps.set-artifact-name.outputs.work }}.tmp
if: ${{ inputs.flavour == 'work' && steps.download-work-1.outcome == 'failure'}}

View File

@@ -1,148 +0,0 @@
---
name: Configure Pipeline for multi-arch image build
on:
workflow_call:
###
### Variables
###
inputs:
enabled:
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
required: true
type: boolean
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
matrix:
description: 'The version build matrix as JSON string ( list of objects: [{NAME, VERSION[], ARCH[]}] ).'
required: true
type: string
refs:
description: 'The ref build matrix as JSON string (list of git refs to build/deploy).'
required: false
type: string
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: false
dockerhub_password:
description: 'The password for Dockerhub.'
required: false
###
### Outouts
###
outputs:
can_login:
description: "Can we login"
value: ${{ jobs.configure.outputs.can_login }}
has_refs:
description: "Do we have refs"
value: ${{ jobs.configure.outputs.has_refs }}
matrix_build:
description: "The determined build matrix"
value: ${{ jobs.configure.outputs.matrix_build }}
matrix_deploy:
description: "The determined deploy matrix"
value: ${{ jobs.configure.outputs.matrix_deploy }}
artifact_prefix:
description: "The determined unique artifact prefix"
value: ${{ jobs.configure.outputs.artifact_prefix }}
jobs:
# -----------------------------------------------------------------------------------------------
# JOB (1/3): CONFIGURE
# -----------------------------------------------------------------------------------------------
configure:
name: Configure
if: inputs.enabled
runs-on: ubuntu-latest
###
### Outputs
###
outputs:
can_login: ${{ steps.set-login.outputs.can_login }}
has_refs: ${{ steps.set-matrix.outputs.has_refs }}
matrix_build: ${{ steps.set-matrix.outputs.matrix_build }}
matrix_deploy: ${{ steps.set-matrix.outputs.matrix_deploy }}
artifact_prefix: ${{ steps.set-artifact-prefix.outputs.prefix }}
###
### Steps
###
steps:
- name: "[Set-Output] Set Docker login capabilities"
id: set-login
shell: bash
run: |
if [ "${{ env.ENV_USER }}" = '' ] || [ "${{ env.ENV_PASS }}" = '' ]; then
echo "::set-output name=can_login::0"
else
echo "::set-output name=can_login::1"
fi
env:
ENV_USER: ${{ secrets.dockerhub_username }}
ENV_PASS: ${{ secrets.dockerhub_password }}
- name: "[Set-Output] Set Build Matrix & Deploy Matrix"
id: set-matrix
shell: bash
run: |
if [ "${{ inputs.refs }}" != "" ]; then
MATRIX_BUILD="$( \
jq -M -c \
--argjson refs '${{ inputs.refs }}' \
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
)"
MATRIX_DEPLOY="$( \
jq -M -c \
--argjson refs '${{ inputs.refs }}' \
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], refs:$refs[]})' <<<'${{ inputs.matrix }}' \
)"
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
echo "::set-output name=has_refs::1"
else
MATRIX_BUILD="$( \
jq -M -c \
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[], arch:.ARCH[]})' <<<'${{ inputs.matrix }}' \
)"
MATRIX_DEPLOY="$( \
jq -M -c \
'map({name:.NAME, version:.VERSION[], flavour:.FLAVOUR[]})' <<<'${{ inputs.matrix }}' \
)"
echo "::set-output name=matrix_build::${MATRIX_BUILD}"
echo "::set-output name=matrix_deploy::${MATRIX_DEPLOY}"
echo "::set-output name=has_refs::0"
fi
- name: "[Set-Output] Set unique Artifact prefix"
id: set-artifact-prefix
shell: bash
run: |
PRE_DATE="$( date +"%s" )"
PRE_RAND="$( echo $RANDOM | md5sum | head -c 10 )"
echo "::set-output name=prefix::${PRE_DATE}-${PRE_RAND}"
- name: "[DEBUG] Show Workflow Inputs"
shell: bash
run: |
echo 'enabled: ${{ inputs.enabled }}'
echo 'can_deploy: ${{ inputs.can_deploy }}'
echo 'matrix: ${{ inputs.matrix }}'
echo 'refs: ${{ inputs.refs }}'
- name: "[DEBUG] Show Determined Settings"
shell: bash
run: |
echo 'can_login=${{ steps.set-login.outputs.can_login }}'
echo 'has_refs=${{ steps.set-matrix.outputs.has_refs }}'
echo 'matrix_build=${{ steps.set-matrix.outputs.matrix_build }}'
echo 'matrix_deploy=${{ steps.set-matrix.outputs.matrix_deploy }}'
echo 'artifact_prefix=${{ steps.set-artifact-prefix.outputs.prefix }}'

View File

@@ -1,242 +0,0 @@
name: Deploy multi-arch images
on:
workflow_call:
###
### Variables
###
inputs:
enabled:
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
required: true
type: boolean
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
build_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
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: false
dockerhub_password:
description: 'The password for Dockerhub.'
required: false
jobs:
deploy:
name: ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.build_matrix) }}
if: inputs.enabled
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_BASE="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-base"
NAME_MODS="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-mods"
NAME_PROD="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-prod"
NAME_WORK="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-work"
echo "::set-output name=base::${NAME_BASE}"
echo "::set-output name=mods::${NAME_MODS}"
echo "::set-output name=prod::${NAME_PROD}"
echo "::set-output name=work::${NAME_WORK}"
# ------------------------------------------------------------
# Artifact Import
# ------------------------------------------------------------
###
### Download and import base
###
- name: "[Artifact Load] Download base"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.base }}
attempt_limit: 20
attempt_delay: 10000
- name: "[Artifact Load] Import base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.base }}
###
### Download and import mods
###
- name: "[Artifact Load] Download mods"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.mods }}
attempt_limit: 20
attempt_delay: 10000
- name: "[Artifact Load] Import mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.mods }}
###
### Download and import prod
###
- name: "[Artifact Load] Download prod"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.prod }}
attempt_limit: 20
attempt_delay: 10000
- name: "[Artifact Load] Import prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.prod }}
###
### Download and import prod
###
- name: "[Artifact Load] Download work"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.work }}
attempt_limit: 20
attempt_delay: 10000
- name: "[Artifact Load] Import work"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.work }}
# ------------------------------------------------------------
# Re-tag images
# ------------------------------------------------------------
- name: "[Docker Tag] base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make tag VERSION=${{ matrix.version }} FLAVOUR=base TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Docker Tag] mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make tag VERSION=${{ matrix.version }} FLAVOUR=mods TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Docker Tag] prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make tag VERSION=${{ matrix.version }} FLAVOUR=prod TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Docker Tag] work"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make tag VERSION=${{ matrix.version }} FLAVOUR=work 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] base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make push VERSION=${{ matrix.version }} FLAVOUR=base TAG=${{ steps.tag.outputs.docker-tag }}
if: ${{ inputs.can_deploy }}
- name: "[Push Image] mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make push VERSION=${{ matrix.version }} FLAVOUR=mods TAG=${{ steps.tag.outputs.docker-tag }}
if: ${{ inputs.can_deploy }}
- name: "[Push Image] prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make push VERSION=${{ matrix.version }} FLAVOUR=prod TAG=${{ steps.tag.outputs.docker-tag }}
if: ${{ inputs.can_deploy }}
- name: "[Push Image] work"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make push VERSION=${{ matrix.version }} FLAVOUR=work TAG=${{ steps.tag.outputs.docker-tag }}
if: ${{ inputs.can_deploy }}

View File

@@ -1,162 +0,0 @@
name: Deploy multi-arch image manifests
on:
workflow_call:
###
### Variables
###
inputs:
enabled:
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
required: true
type: boolean
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
deploy_matrix:
description: 'The version deploy matrix as JSON string ( list of objects: [{NAME, VERSION[], ARCH[]}] ).'
required: true
type: string
params_matrix:
description: 'The build matrix set via params.yml.'
required: true
type: string
artifact_prefix:
description: 'Unique artifact name prefix (to avoid overriding existing artifcats during parallel runs).'
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
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: false
dockerhub_password:
description: 'The password for Dockerhub.'
required: false
jobs:
# -----------------------------------------------------------------------------------------------
# JOB (3/3): DEPLOY
# -----------------------------------------------------------------------------------------------
deploy:
name: ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.flavour }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.deploy_matrix) }}
if: inputs.enabled && inputs.can_deploy
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] Determine manifest arches"
id: manifest
run: |
ARCHES="$( echo '${{ inputs.params_matrix }}' \
| jq 'group_by(.NAME, .VERSION, .ARCH)' \
| jq 'map({NAME: .[].NAME, VERSION: .[].VERSION[], FLAVOUR: .[].FLAVOUR[], ARCHES: .[].ARCH|join(",")})' \
| jq '.[] | select(.NAME=="${{ matrix.name }}" and .VERSION=="${{ matrix.version }}" and .FLAVOUR=="${{ matrix.flavour }}") | .ARCHES' \
| jq -c -M \
)"
echo "::set-output name=arches::${ARCHES}"
echo "ARCHES: ${ARCHES}"
# ------------------------------------------------------------
# Login
# ------------------------------------------------------------
- name: "Login"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# ------------------------------------------------------------
# Create Manifest
# ------------------------------------------------------------
- name: "[Create Manifest] base (${{ steps.manifest.outputs.arches }})"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=base ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Create Manifest] mods (${{ steps.manifest.outputs.arches }})"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=mods ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Create Manifest] prod (${{ steps.manifest.outputs.arches }})"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=prod ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Create Manifest] work (${{ steps.manifest.outputs.arches }})"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-create VERSION=${{ matrix.version }} FLAVOUR=work ARCHES=${{ steps.manifest.outputs.arches }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Deploy Manifest
# ------------------------------------------------------------
- name: "[Push Manifest] base: ${{ steps.tag.outputs.docker-tag }}"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=base TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Push Manifest] mods: ${{ steps.tag.outputs.docker-tag }}"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=mods TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Push Manifest] prod: ${{ steps.tag.outputs.docker-tag }}"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=prod TAG=${{ steps.tag.outputs.docker-tag }}
- name: "[Push Manifest] work: ${{ steps.tag.outputs.docker-tag }}"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make manifest-push VERSION=${{ matrix.version }} FLAVOUR=work TAG=${{ steps.tag.outputs.docker-tag }}

View File

@@ -1,190 +0,0 @@
---
name: Test multi-arch images
on:
workflow_call:
###
### Variables
###
inputs:
enabled:
description: 'Determines wheather this workflow is enabled at all (will run or skip).'
required: true
type: boolean
can_deploy:
description: 'Determines wheather this workflow will also deploy (login and push).'
required: true
type: boolean
build_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 (base, mods, prod or work).'
required: true
type: string
###
### Secrets
###
secrets:
dockerhub_username:
description: 'The username for Dockerhub.'
required: false
dockerhub_password:
description: 'The password for Dockerhub.'
required: false
jobs:
# -----------------------------------------------------------------------------------------------
# JOB: BUILD
# -----------------------------------------------------------------------------------------------
test:
name: ${{ matrix.name }}-${{ matrix.version }}-${{ inputs.flavour }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(inputs.build_matrix) }}
if: inputs.enabled
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] 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_BASE="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-base"
NAME_MODS="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-mods"
NAME_PROD="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-prod"
NAME_WORK="${{ inputs.artifact_prefix }}-${PRE_HASH}-${VERSION}-${ARCH}-work"
echo "::set-output name=base::${NAME_BASE}"
echo "::set-output name=mods::${NAME_MODS}"
echo "::set-output name=prod::${NAME_PROD}"
echo "::set-output name=work::${NAME_WORK}"
# ------------------------------------------------------------
# Artifact Import
# ------------------------------------------------------------
###
### Download and import base
###
- name: "[Artifact Load] Download base"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.base }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'base' }}
- name: "[Artifact Load] Import base"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.base }}
if: ${{ inputs.flavour == 'base' }}
###
### Download and import mods
###
- name: "[Artifact Load] Download mods"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.mods }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'mods' }}
- name: "[Artifact Load] Import mods"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.mods }}
if: ${{ inputs.flavour == 'mods' }}
###
### Download and import prod
###
- name: "[Artifact Load] Download prod"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.prod }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'prod' }}
- name: "[Artifact Load] Import prod"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.prod }}
if: ${{ inputs.flavour == 'prod' }}
###
### Download and import work
###
- name: "[Artifact Load] Download work"
uses: Wandalen/wretry.action@v1.0.11
with:
action: actions/download-artifact@v3
with: |
name: ${{ steps.set-artifact-name.outputs.work }}
attempt_limit: 20
attempt_delay: 10000
if: ${{ inputs.flavour == 'work' }}
- name: "[Artifact Load] Import work"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load INFILE=${{ steps.set-artifact-name.outputs.work }}
if: ${{ inputs.flavour == 'work' }}
# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
- name: Test
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make test VERSION=${{ matrix.version }} FLAVOUR=${{ inputs.flavour }} ARCH=${{ matrix.arch }}