inpsyde/reusable-workflows

[Feature Request]: build-and-push-assets - allow choosing DEV/PROD build script

Closed this issue · 1 comments

Chrico commented

Is your feature request related to a problem?

Right now in build-and-push-assets.yml we have 2 inputs: COMPILE_SCRIPT_PROD and COMPILE_SCRIPT_DEV. Those are used on either "push to branch" (DEV) or "create tag" (PROD).

It is not possible to bulid DEV-assets when creating a (pre-)release and it is not possible to build PROD-assets when pushing to a branch.

Describe the desired solution

In best case we should introduce some MODE-input which can bei either "DEV" or "PROD" and is by default empty. This way we have following scenarios covered:

value description
'' empty value falls back to current behavior: push to branch = DEV, create tag = PROD
'DEV' uses the inputs.COMPILE_SCRIPT_DEV script
'PROD' uses the inputs.COMPILE_SCRIPT_PROD script

Describe the alternatives that you have considered

Additional context

Following open topics exists:

  1. Naming of the MODE input.
  2. Naming of the possible values (DEV <-> PROD or develop <-> production or develoment <-> producton or ...)

Code of Conduct

  • I agree to follow this project's Code of Conduct

This workflow is defining some logic based on the type of ref, for now, branches, and tags. I think it is ok.

The current problem is that we are deciding which MODE of compile script to run based on that. This is another decision.

I can think of two approaches:
Option 1: The consumer decides which build script to use:

We expose a variable COMPILE_SCRIPT and let the consumer decide which script to use using some logic like:

COMPILE_SCRIPT: ${{ github.ref_type == 'branch' && github.ref_name == 'main' && 'build' || 'build:dev' }}

Option 2: Base the decision on the ref type directly.
Instead of exposing COMPILE_SCRIPT_DEV, COMPILE_SCRIPT_PROD, we could rely on:

  1. COMPILE_SCRIPT_BRANCHES
  2. COMPILE_SCRIPT_TAGS

Leaving this message for later analysis.

Best,
Luis