@@ -38,7 +38,7 @@ inputs:
3838 description : ' Image provider (only for Nuxt)'
3939 required : false
4040 default : ' ipx'
41- extra_docker_envs :
41+ docker_buildargs :
4242 description : ' List of additional ENVs that should be passed at Docker image build-time'
4343 required : false
4444runs :
@@ -55,16 +55,20 @@ runs:
5555 username : ${{ inputs.cloud_username }}
5656 password : ${{ inputs.cloud_password }}
5757
58- - name : Resolve docker envs
59- id : docker_envs
58+ - name : Resolve docker buildargs
59+ id : resolve
6060 uses : actions/github-script@v7
6161 env :
6262 INPUT_NPM_EMAIL : ${{ inputs.npm_email }}
6363 INPUT_NPM_PASS : ${{ inputs.npm_pass }}
6464 INPUT_NPM_USER : ${{ inputs.npm_user }}
6565 INPUT_NPM_REGISTRY : ${{ inputs.npm_registry }}
6666 INPUT_IMAGE_PROVIDER : ${{ inputs.image_provider }}
67- INPUT_EXTRA_DOCKER_ENVS : ${{ inputs.extra_docker_envs }}
67+ INPUT_DOCKER_BUILDARGS : ${{ inputs.docker_buildargs }}
68+ INPUT_FRONTEND : ${{ inputs.frontend }}
69+ INPUT_VERSION : ${{ inputs.version }}
70+ INPUT_DOCKER_REGISTRY_URL : ${{ inputs.docker_registry_url }}
71+ INPUT_PROJECT_NAME : ${{ inputs.project_name }}
6872 with :
6973 script : |
7074 const base = {
@@ -75,38 +79,34 @@ runs:
7579 'NUXT_IMAGE_PROVIDER': core.getInput('image_provider'),
7680 };
7781
78- const transformedBaseEnv = Object.entries(base)
82+ const transformedBaseArgs = Object.entries(base)
7983 .map(([key, value]) => `${key}=${value}`);
8084
81- const extraEnvs = core.getMultilineInput('extra_docker_envs ', { required: false });
82- const mergedEnvs = [
83- ...transformedBaseEnv,
84- ...extraEnvs ,
85- ]
85+ const extraArgs = core.getMultilineInput('docker_buildargs ', { required: false });
86+ const mergedArgs = [
87+ ...transformedBaseArgs
88+ ...extraArgs ,
89+ ];
8690
87- core.setOutput('envs ', mergedEnvs );
91+ core.setOutput('docker_args ', mergedArgs );
8892
89- - name : Resolve values of the versions, docker ref & dockerfile path
90- id : resolve
91- shell : bash
92- run : |
93- # Set the version of the app based on user input or use git commit hash
94- echo "version=${{ inputs.version || github.sha }}" >> $GITHUB_OUTPUT
95- # Set the reference address for app in docker registry
96- echo "ref=${{ inputs.docker_registry_url }}/${{ inputs.project_name }}-storefrontcloud-io" >> $GITHUB_OUTPUT
97- # Set the path to the Dockerfile base on selected frontend framework
98- if [[ $FRONTEND == "next" ]]; then
99- echo "path=.vuestorefrontcloud/docker/nextjs/Dockerfile-frontend" >> $GITHUB_OUTPUT
100- elif [[ $FRONTEND == "nextjs" ]]; then
101- echo "path=.vuestorefrontcloud/docker/nextjs/Dockerfile-frontend" >> $GITHUB_OUTPUT
102- elif [[ $FRONTEND == "nuxt" ]]; then
103- echo "path=.vuestorefrontcloud/docker/nuxtjs/Dockerfile-frontend" >> $GITHUB_OUTPUT
104- else
105- echo "Error: Unsupported FRONTEND value. Valid options are 'next' or 'nuxt'."
106- exit 1
107- fi
108- env :
109- FRONTEND : ${{ inputs.frontend }}
93+ const versionInput = core.getIntput('version');
94+ core.setOutput('version', versionInput || context.sha);
95+
96+ core.setOutput('ref', `${core.getInput('docker_registry_url')}/${core.getInput('project_name')}-storefrontcloud-io`);
97+
98+ const frontendInput = core.getInput('frontend');
99+
100+ switch (frontend) {
101+ case "next":
102+ core.setOutput('path', '.vuestorefrontcloud/docker/nextjs/Dockerfile-frontend');
103+ break;
104+ case "nuxt":
105+ core.setOutput('path', '.vuestorefrontcloud/docker/nuxtjs/Dockerfile-frontend');
106+ break;
107+ default:
108+ core.setOutput('path', '.vuestorefrontcloud/docker/nextjs/Dockerfile-frontend')
109+ }
110110
111111 - name : Check for existing image
112112 id : check-existing-image
@@ -126,4 +126,4 @@ runs:
126126 tags : ${{ steps.resolve.outputs.ref }}/vue-storefront:${{ steps.resolve.outputs.version }}
127127 cache-from : " type=registry,ref=${{ steps.resolve.outputs.ref }}/vue-storefront:buildcache"
128128 cache-to : " type=registry,ref=${{ steps.resolve.outputs.ref }}/vue-storefront:buildcache,mode=max"
129- build-args : ${{ steps.docker_envs.envs }}
129+ build-args : ${{ steps.resolve.outputs.docker_args }}
0 commit comments