From 9a55f3a488a7e21d110458e3af189567f383af51 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Wed, 6 Dec 2023 11:52:18 +0100 Subject: [PATCH 1/3] Make it possible to override git urls and branches By either defining it in `ENVIRONMENT` or in a `.env`file. That enables us to override it in Github actions and in local development. --- Taskfile.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index ccbf7b1..1f69013 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -7,6 +7,25 @@ vars: CMS_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-cms" REACT_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-react" +vars: + # Defaults + DEFAULT_GIT_REPO_URL_DESIGN_SYSTEM: git@github.com:danskernesdigitalebibliotek/dpl-design-system + DEFAULT_GIT_BRANCH_DESIGN_SYSTEM: develop + DEFAULT_GIT_REPO_URL_REACT: git@github.com:danskernesdigitalebibliotek/dpl-react + DEFAULT_GIT_BRANCH_REACT: develop + DEFAULT_GIT_REPO_URL_CMS: git@github.com:danskernesdigitalebibliotek/dpl-cms + DEFAULT_GIT_BRANCH_CMS: develop + # Actual values + GIT_REPO_URL_DESIGN_SYSTEM: '{{.GIT_REPO_URL_DESIGN_SYSTEM | default .DEFAULT_GIT_REPO_URL_DESIGN_SYSTEM}}' + GIT_BRANCH_DESIGN_SYSTEM: '{{.GIT_BRANCH_DESIGN_SYSTEM | default .DEFAULT_GIT_BRANCH_DESIGN_SYSTEM}}' + GIT_REPO_URL_REACT: '{{.GIT_REPO_URL_REACT | default .DEFAULT_GIT_REPO_URL_REACT}}' + GIT_BRANCH_REACT: '{{.GIT_BRANCH_REACT | default .DEFAULT_GIT_BRANCH_REACT}}' + GIT_REPO_URL_CMS: '{{.GIT_REPO_URL_CMS | default .DEFAULT_GIT_REPO_URL_CMS}}' + GIT_BRANCH_CMS: '{{.GIT_BRANCH_CMS | default .DEFAULT_GIT_BRANCH_CMS}}' + +# If vars are specified here they will override the defaults above. +dotenv: ['.env'] + tasks: init: summary: Setup this directory for development @@ -38,7 +57,7 @@ tasks: design-system:clone: cmds: - - git clone https://github.com/danskernesdigitalebibliotek/dpl-design-system design-system + - git clone {{ .GIT_REPO_URL_DESIGN_SYSTEM }} -b {{ .GIT_BRANCH_DESIGN_SYSTEM }} design-system design-system:install: dir: design-system @@ -82,7 +101,7 @@ tasks: react:clone: cmds: - - git clone https://github.com/danskernesdigitalebibliotek/dpl-react react + - git clone {{ .GIT_REPO_URL_REACT}} -b {{ .GIT_BRANCH_REACT }} react # Set project name to avoid conflicts with single checkouts. - cp react/.env.example react/.env - echo "COMPOSE_PROJECT_NAME={{.REACT_COMPOSE_PROJECT_NAME}}" >> react/.env @@ -133,7 +152,7 @@ tasks: cms:clone: cmds: - - git clone https://github.com/danskernesdigitalebibliotek/dpl-cms cms + - git clone {{ .GIT_REPO_URL_CMS }} -b {{ .GIT_BRANCH_CMS }} cms # Set project name to avoid conflicts with single checkouts. - sed "s|COMPOSE_PROJECT_NAME=dpl-cms|COMPOSE_PROJECT_NAME={{.CMS_COMPOSE_PROJECT_NAME}}|g" cms/.env From e347a3424361bd5ab3914ad7eac3e2536087b458 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Wed, 6 Dec 2023 11:55:27 +0100 Subject: [PATCH 2/3] Use https urls for repos prevents us for using secrets/tokens when testing --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3cf4cbd..8b0947c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,9 @@ on: env: # Group output as we make heavy use of parallel and nested tasks. TASK_OUTPUT: "--output group --output-group-begin '::group::{{.TASK}}' --output-group-end '::endgroup::'" + GIT_REPO_URL_DESIGN_SYSTEM: https://github.com/danskernesdigitalebibliotek/dpl-design-system + GIT_REPO_URL_REACT: https://github.com/danskernesdigitalebibliotek/dpl-react + GIT_REPO_URL_CMS: https://github.com/danskernesdigitalebibliotek/dpl-cms jobs: test: From 4c11cd7b62f9d79bf0f73be3944820ff121b7162 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Wed, 6 Dec 2023 12:06:43 +0100 Subject: [PATCH 3/3] Consolidate Taskfile vars Since vars were introduced in to diffrent commits, this commit consolidates them. --- Taskfile.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 1f69013..674b0be 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,8 +6,6 @@ vars: COMPOSE_PREFIX: dapple CMS_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-cms" REACT_COMPOSE_PROJECT_NAME: "{{.COMPOSE_PREFIX}}-react" - -vars: # Defaults DEFAULT_GIT_REPO_URL_DESIGN_SYSTEM: git@github.com:danskernesdigitalebibliotek/dpl-design-system DEFAULT_GIT_BRANCH_DESIGN_SYSTEM: develop