Skip to content

Commit

Permalink
Refactor Docker image building workflow and action
Browse files Browse the repository at this point in the history
  • Loading branch information
tomitheninja committed Sep 26, 2024
1 parent f02a010 commit b3a007c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/self-images-worker.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/self-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deployment workflow

on:
push:
branches:
- main
workflow_call:

jobs:
staging:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
matrix:
environment:
- staging
- production
max-parallel: 1

environment: ${{ matrix.environment }}

env:
DOCKER_TAG: ${{ matrix.environment == 'production' && 'latest' || 'edge' }}
DOCKER_REGISTRY: ghcr.io
DOCKER_NAMESPACE: ${{ github.repository_owner }}
DOCKER_EXTRA_ARGS: --label org.opencontainers.image.source=https://github.com/${{ github.repository }} --cache-from type=gha,mode=max --cache-to type=gha,mode=max

steps:
- uses: actions/checkout@v4
- uses: kir-dev/automations/actions/infra-build-images@feat/build-docker-actions
with:
registry: ${{ env.DOCKER_NAMESPACE }}
namespace: ${{ env.DOCKER_NAMESPACE }}
docker-tag: ${{ env.DOCKER_TAG }}
extra-args: --push ${{ env.DOCKER_EXTRA_ARGS }}
3 changes: 1 addition & 2 deletions actions/infra-build-images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ description: Automation Images Manager Action
inputs:
registry:
required: true
default: 'ghcr.io'
description: 'The docker registry to use'
namespace:
required: true
Expand All @@ -27,4 +26,4 @@ runs:
${{ inputs.command_path }}/build-docker-actions.sh \
${{ inputs.registry }}/${{ inputs.namespace }} \
${{ inputs.docker-tag }} \
'--push --cache-from type=gha,mode=max --cache-to type=gha,mode=max --label org.opencontainers.image.source=https://github.com/${{ github.repository }}'
'${{ inputs.extra-args }}'

0 comments on commit b3a007c

Please sign in to comment.